[Minor] code cleanup

This commit is contained in:
Robert von Burg 2014-09-14 12:20:44 +02:00
parent 92286c9b13
commit 70d2318852
31 changed files with 132 additions and 68 deletions

View File

@ -45,8 +45,10 @@ public abstract class AbstractStrolchElement implements StrolchElement {
/** /**
* Default constructor * Default constructor
* *
* @param id id of this {@link StrolchElement} * @param id
* @param name name of this {@link StrolchElement} * id of this {@link StrolchElement}
* @param name
* name of this {@link StrolchElement}
*/ */
public AbstractStrolchElement(String id, String name) { public AbstractStrolchElement(String id, String name) {
setId(id); setId(id);
@ -97,8 +99,8 @@ public abstract class AbstractStrolchElement implements StrolchElement {
* Used to build a {@link Locator} for this {@link StrolchElement}. It must be implemented by the concrete * Used to build a {@link Locator} for this {@link StrolchElement}. It must be implemented by the concrete
* implemented as parents must first add their {@link Locator} information * implemented as parents must first add their {@link Locator} information
* *
* @param locatorBuilder the {@link LocatorBuilder} to which the {@link StrolchElement} must add its locator * @param locatorBuilder
* information * the {@link LocatorBuilder} to which the {@link StrolchElement} must add its locator information
*/ */
protected abstract void fillLocator(LocatorBuilder locatorBuilder); protected abstract void fillLocator(LocatorBuilder locatorBuilder);

View File

@ -230,7 +230,7 @@ public class ModelGenerator {
List<Resource> resources = new ArrayList<>(); List<Resource> resources = new ArrayList<>();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String id = StringHelper.normalizeLength(String.valueOf((i + idStart)), 8, true, '0'); String id = StringHelper.normalizeLength(String.valueOf((i + idStart)), 8, true, '0');
resources.add(createResource(idPrefix + "_" + id, name + " " + i, type)); resources.add(createResource(idPrefix + id, name + " " + i, type));
} }
return resources; return resources;
} }
@ -299,7 +299,7 @@ public class ModelGenerator {
List<Order> orders = new ArrayList<>(); List<Order> orders = new ArrayList<>();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String id = StringHelper.normalizeLength(String.valueOf((i + idStart)), 8, true, '0'); String id = StringHelper.normalizeLength(String.valueOf((i + idStart)), 8, true, '0');
orders.add(createOrder(idPrefix + "_" + id, name + " " + i, type)); orders.add(createOrder(idPrefix + id, name + " " + i, type));
} }
return orders; return orders;
} }

View File

@ -36,8 +36,7 @@ public class ModelStatistics {
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(getClass().getSimpleName() + " [startTime="); builder.append(getClass().getSimpleName() + " [startTime=");
builder.append(this.startTime == null ? NULL : ISO8601FormatFactory.getInstance() builder.append(this.startTime == null ? NULL : ISO8601FormatFactory.getInstance().formatDate(this.startTime));
.formatDate(this.startTime));
builder.append(", durationNanos="); builder.append(", durationNanos=");
builder.append(StringHelper.formatNanoDuration(this.durationNanos)); builder.append(StringHelper.formatNanoDuration(this.durationNanos));
builder.append(", nrOfResources="); builder.append(", nrOfResources=");

View File

@ -215,7 +215,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
Element paramElement = (Element) parameterElements.item(i); Element paramElement = (Element) parameterElements.item(i);
String paramtype = paramElement.getAttribute(Tags.TYPE); String paramtype = paramElement.getAttribute(Tags.TYPE);
DBC.PRE.assertNotEmpty("Type must be set on Parameter for bag with id " + id, paramtype); DBC.PRE.assertNotEmpty("Type must be set on Parameter for bag with id " + this.id, paramtype);
if (paramtype.equals(StringParameter.TYPE)) { if (paramtype.equals(StringParameter.TYPE)) {
StringParameter param = new StringParameter(paramElement); StringParameter param = new StringParameter(paramElement);

View File

@ -80,7 +80,7 @@ public class Resource extends GroupedParameterizedElement implements StrolchRoot
Element timedStateElem = (Element) timedStateElems.item(i); Element timedStateElem = (Element) timedStateElems.item(i);
String typeS = timedStateElem.getAttribute(Tags.TYPE); String typeS = timedStateElem.getAttribute(Tags.TYPE);
DBC.PRE.assertNotEmpty("Type must be set on TimedState for resource with id " + id, typeS); DBC.PRE.assertNotEmpty("Type must be set on TimedState for resource with id " + this.id, typeS);
if (typeS.equals(FloatTimedState.TYPE)) { if (typeS.equals(FloatTimedState.TYPE)) {
FloatTimedState timedState = new FloatTimedState(timedStateElem); FloatTimedState timedState = new FloatTimedState(timedStateElem);

View File

@ -79,8 +79,9 @@ public interface StrolchElement extends Serializable, Comparable<StrolchElement>
/** /**
* Returns an {@link Element} object which is an XML representation of this object * Returns an {@link Element} object which is an XML representation of this object
* *
* @param doc the document to which this element is being written. The client must not append to the document, the * @param doc
* caller will perform this as needed * the document to which this element is being written. The client must not append to the document, the
* caller will perform this as needed
* *
* @return * @return
*/ */

View File

@ -20,7 +20,6 @@ public class StrolchModelConstants {
* to an {@link Order} * to an {@link Order}
*/ */
public static final String INTERPRETATION_ORDER_REF = "Order-Ref"; //$NON-NLS-1$ public static final String INTERPRETATION_ORDER_REF = "Order-Ref"; //$NON-NLS-1$
/** /**
* This interpretation value indicates that the {@link Parameter} has no defined interpretation * This interpretation value indicates that the {@link Parameter} has no defined interpretation

View File

@ -68,7 +68,7 @@ public class AuditQuery implements StrolchQuery {
DBC.PRE.assertNotNull("No elementTypeSelection (navigation) set!", this.elementTypeSelection); //$NON-NLS-1$ DBC.PRE.assertNotNull("No elementTypeSelection (navigation) set!", this.elementTypeSelection); //$NON-NLS-1$
DBC.PRE.assertNotNull("No dateRange set!", this.dateRange); //$NON-NLS-1$ DBC.PRE.assertNotNull("No dateRange set!", this.dateRange); //$NON-NLS-1$
visitor.visit(this); visitor.visit(this);
for (AuditSelection selection : selections) { for (AuditSelection selection : this.selections) {
selection.accept(visitor); selection.accept(visitor);
} }
} }

View File

@ -28,14 +28,16 @@ public interface ListParameter<E> extends Parameter<List<E>> {
/** /**
* Adds a single value to the {@link List} of values * Adds a single value to the {@link List} of values
* *
* @param value the value to add * @param value
* the value to add
*/ */
public void addValue(E value); public void addValue(E value);
/** /**
* Removes a single value from the {@link List} of values * Removes a single value from the {@link List} of values
* *
* @param value the value to remove * @param value
* the value to remove
* *
* @return true if the value was removed, false if it did not exist * @return true if the value was removed, false if it did not exist
*/ */

View File

@ -28,7 +28,8 @@ public class NotSelection extends BooleanSelection {
} }
/** /**
* @throws UnsupportedOperationException because a {@link NotSelection} can only work on a single {@link Selection} * @throws UnsupportedOperationException
* because a {@link NotSelection} can only work on a single {@link Selection}
*/ */
@Override @Override
public NotSelection with(Selection selection) { public NotSelection with(Selection selection) {

View File

@ -63,6 +63,7 @@ public class ParameterBagSelection implements Selection {
super(bagKey); super(bagKey);
} }
@Override
public void accept(StrolchRootElementSelectionVisitor visitor) { public void accept(StrolchRootElementSelectionVisitor visitor) {
visitor.visit(this); visitor.visit(this);
} }

View File

@ -21,7 +21,7 @@ package li.strolch.model.query;
public interface QueryVisitor { public interface QueryVisitor {
public void visitAny(); public void visitAny();
public void visitAnd(AndSelection andSelection); public void visitAnd(AndSelection andSelection);
public void visitOr(OrSelection orSelection); public void visitOr(OrSelection orSelection);

View File

@ -76,7 +76,7 @@ public class StringSelection {
} }
public boolean matches(String value) { public boolean matches(String value) {
for (String sel : values) { for (String sel : this.values) {
if (this.matchMode.matches(value, sel)) if (this.matchMode.matches(value, sel))
return true; return true;
} }

View File

@ -16,10 +16,12 @@
package li.strolch.model.timedstate; package li.strolch.model.timedstate;
import java.util.SortedSet; import java.util.SortedSet;
import li.strolch.model.StrolchElement; import li.strolch.model.StrolchElement;
import li.strolch.model.Tags; import li.strolch.model.Tags;
import li.strolch.model.timevalue.ITimeValue; import li.strolch.model.timevalue.ITimeValue;
import li.strolch.model.timevalue.impl.BooleanValue; import li.strolch.model.timevalue.impl.BooleanValue;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;

View File

@ -16,10 +16,12 @@
package li.strolch.model.timedstate; package li.strolch.model.timedstate;
import java.util.SortedSet; import java.util.SortedSet;
import li.strolch.model.StrolchElement; import li.strolch.model.StrolchElement;
import li.strolch.model.Tags; import li.strolch.model.Tags;
import li.strolch.model.timevalue.ITimeValue; import li.strolch.model.timevalue.ITimeValue;
import li.strolch.model.timevalue.impl.FloatValue; import li.strolch.model.timevalue.impl.FloatValue;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;

View File

@ -25,7 +25,8 @@ import li.strolch.model.timevalue.IValueChange;
* *
* @author Martin Smock <smock.martin@gmail.com> * @author Martin Smock <smock.martin@gmail.com>
* *
* @param <T> IValue implementation representing the state at a given time * @param <T>
* IValue implementation representing the state at a given time
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public interface ITimedState<T extends IValue> { public interface ITimedState<T extends IValue> {
@ -41,7 +42,8 @@ public interface ITimedState<T extends IValue> {
ITimeValue<T> getPreviousMatch(final Long time, T value); ITimeValue<T> getPreviousMatch(final Long time, T value);
/** /**
* @param change the state change to be applied * @param change
* the state change to be applied
*/ */
<U extends IValueChange<T>> void applyChange(final U change); <U extends IValueChange<T>> void applyChange(final U change);

View File

@ -16,10 +16,12 @@
package li.strolch.model.timedstate; package li.strolch.model.timedstate;
import java.util.SortedSet; import java.util.SortedSet;
import li.strolch.model.StrolchElement; import li.strolch.model.StrolchElement;
import li.strolch.model.Tags; import li.strolch.model.Tags;
import li.strolch.model.timevalue.ITimeValue; import li.strolch.model.timevalue.ITimeValue;
import li.strolch.model.timevalue.impl.IntegerValue; import li.strolch.model.timevalue.impl.IntegerValue;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;

View File

@ -19,11 +19,13 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import li.strolch.model.StrolchElement; import li.strolch.model.StrolchElement;
import li.strolch.model.Tags; import li.strolch.model.Tags;
import li.strolch.model.timevalue.ITimeValue; import li.strolch.model.timevalue.ITimeValue;
import li.strolch.model.timevalue.impl.AString; import li.strolch.model.timevalue.impl.AString;
import li.strolch.model.timevalue.impl.StringSetValue; import li.strolch.model.timevalue.impl.StringSetValue;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;

View File

@ -22,7 +22,8 @@ import li.strolch.model.timevalue.impl.TimeVariable;
* *
* @author Martin Smock <smock.martin@gmail.com> * @author Martin Smock <smock.martin@gmail.com>
* *
* @param <T> the backing value of the timed value object * @param <T>
* the backing value of the timed value object
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public interface ITimeValue<T extends IValue> extends Comparable<ITimeValue<T>> { public interface ITimeValue<T extends IValue> extends Comparable<ITimeValue<T>> {

View File

@ -23,7 +23,8 @@ import java.util.SortedSet;
* *
* @author Martin Smock <smock.martin@gmail.com> * @author Martin Smock <smock.martin@gmail.com>
* *
* @param <T> the backing value of the timed value object * @param <T>
* the backing value of the timed value object
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public interface ITimeVariable<T extends IValue> { public interface ITimeVariable<T extends IValue> {
@ -31,8 +32,10 @@ public interface ITimeVariable<T extends IValue> {
/** /**
* set the value at a point in time to a given time value object * set the value at a point in time to a given time value object
* *
* @param time the time to set the {@link IValue} * @param time
* @param value the {@link IValue} to set * the time to set the {@link IValue}
* @param value
* the {@link IValue} to set
*/ */
void setValueAt(final Long time, final T value); void setValueAt(final Long time, final T value);
@ -44,14 +47,16 @@ public interface ITimeVariable<T extends IValue> {
/** /**
* Applies a {@link IValueChange} propagating the change to all future values starting from the time of the change. * Applies a {@link IValueChange} propagating the change to all future values starting from the time of the change.
* *
* @param change the {@link IValueChange} to be applied * @param change
* the {@link IValueChange} to be applied
*/ */
void applyChange(final IValueChange<T> change); void applyChange(final IValueChange<T> change);
/** /**
* Get all {@link ITimeValue} objects whose time field is greater or equal to the given time * Get all {@link ITimeValue} objects whose time field is greater or equal to the given time
* *
* @param time the time the sequence starts with * @param time
* the time the sequence starts with
* @return the sequence of {@link ITimeValue} objects in the future * @return the sequence of {@link ITimeValue} objects in the future
*/ */
Collection<ITimeValue<T>> getFutureValues(final Long time); Collection<ITimeValue<T>> getFutureValues(final Long time);
@ -59,7 +64,8 @@ public interface ITimeVariable<T extends IValue> {
/** /**
* Get all {@link ITimeValue} objects whose time field is strictly smaller than the given time * Get all {@link ITimeValue} objects whose time field is strictly smaller than the given time
* *
* @param time the time the sequence starts with * @param time
* the time the sequence starts with
* @return the sequence of {@link ITimeValue} objects in the future * @return the sequence of {@link ITimeValue} objects in the future
*/ */
Collection<ITimeValue<T>> getPastValues(final Long time); Collection<ITimeValue<T>> getPastValues(final Long time);

View File

@ -21,7 +21,8 @@ package li.strolch.model.timevalue;
* *
* @author Martin Smock <smock.martin@gmail.com> * @author Martin Smock <smock.martin@gmail.com>
* *
* @param <T> any object for which a (generalized) add operation can be defined. * @param <T>
* any object for which a (generalized) add operation can be defined.
*/ */
public interface IValue<T> { public interface IValue<T> {
@ -49,7 +50,7 @@ public interface IValue<T> {
* @return a copy of this * @return a copy of this
*/ */
IValue<T> getCopy(); IValue<T> getCopy();
/** /**
* @return this value in string representation * @return this value in string representation
*/ */

View File

@ -65,7 +65,7 @@ public class BooleanValue implements IValue<Boolean>, Serializable {
public BooleanValue getInverse() { public BooleanValue getInverse() {
return new BooleanValue(!getValue()); return new BooleanValue(!getValue());
} }
@Override @Override
public String getValueAsString() { public String getValueAsString() {
return this.value.toString(); return this.value.toString();

View File

@ -65,7 +65,7 @@ public class IntegerValue implements IValue<Integer>, Serializable {
public IntegerValue getInverse() { public IntegerValue getInverse() {
return new IntegerValue(-getValue()); return new IntegerValue(-getValue());
} }
@Override @Override
public String getValueAsString() { public String getValueAsString() {
return this.value.toString(); return this.value.toString();

View File

@ -110,7 +110,7 @@ public class StringSetValue implements IValue<Set<AString>>, Serializable {
return this.aStrings.iterator().next().getString(); return this.aStrings.iterator().next().getString();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Iterator<AString> iter = aStrings.iterator(); Iterator<AString> iter = this.aStrings.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
sb.append(iter.next()); sb.append(iter.next());
if (iter.hasNext()) if (iter.hasNext())

View File

@ -72,7 +72,7 @@ public class TimeValue<T extends IValue> implements ITimeValue<T>, Serializable
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public ITimeValue<T> getCopy() { public ITimeValue<T> getCopy() {
return new TimeValue<T>(time, (T) value.getCopy()); return new TimeValue<T>(this.time, (T) this.value.getCopy());
} }
@SuppressWarnings("nls") @SuppressWarnings("nls")

View File

@ -56,14 +56,14 @@ public abstract class AbstractToSaxWriterVisitor {
protected void writeElement(String tag, Order order) throws XMLStreamException { protected void writeElement(String tag, Order order) throws XMLStreamException {
boolean empty = !order.hasParameterBags(); boolean empty = !order.hasParameterBags();
writeElement(tag, empty, (GroupedParameterizedElement) order); writeElement(tag, empty, order);
if (!empty) if (!empty)
this.writer.writeEndElement(); this.writer.writeEndElement();
} }
protected void writeElement(String tag, Resource resource) throws XMLStreamException { protected void writeElement(String tag, Resource resource) throws XMLStreamException {
boolean empty = !resource.hasParameterBags() && !resource.hasTimedStates(); boolean empty = !resource.hasParameterBags() && !resource.hasTimedStates();
writeElement(tag, empty, (GroupedParameterizedElement) resource); writeElement(tag, empty, resource);
if (resource.hasTimedStates()) if (resource.hasTimedStates())
writeTimedStates(resource); writeTimedStates(resource);
@ -85,13 +85,13 @@ public abstract class AbstractToSaxWriterVisitor {
writeStartStrolchElement(Tags.TIMED_STATE, !values.isEmpty(), timedState); writeStartStrolchElement(Tags.TIMED_STATE, !values.isEmpty(), timedState);
for (ITimeValue<IValue<?>> timeValue : values) { for (ITimeValue<IValue<?>> timeValue : values) {
writer.writeEmptyElement(Tags.VALUE); this.writer.writeEmptyElement(Tags.VALUE);
writer.writeAttribute(Tags.TIME, timeValue.getTime().toString()); this.writer.writeAttribute(Tags.TIME, timeValue.getTime().toString());
writer.writeAttribute(Tags.VALUE, timeValue.getValue().getValueAsString()); this.writer.writeAttribute(Tags.VALUE, timeValue.getValue().getValueAsString());
} }
if (!values.isEmpty()) if (!values.isEmpty())
writer.writeEndElement(); this.writer.writeEndElement();
} }
} }

View File

@ -54,28 +54,28 @@ public class XmlModelSaxFileReader extends XmlModelSaxReader {
switch (qName) { switch (qName) {
case Tags.INCLUDE_FILE: case Tags.INCLUDE_FILE:
String includeFileS = attributes.getValue(Tags.FILE); String includeFileS = attributes.getValue(Tags.FILE);
if (StringHelper.isEmpty(includeFileS)) { if (StringHelper.isEmpty(includeFileS)) {
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
"The attribute {0} is missing for IncludeFile!", Tags.FILE)); //$NON-NLS-1$ "The attribute {0} is missing for IncludeFile!", Tags.FILE)); //$NON-NLS-1$
} }
File includeFile = new File(this.modelFile.getParentFile(), includeFileS); File includeFile = new File(this.modelFile.getParentFile(), includeFileS);
if (!includeFile.exists() || !includeFile.canRead()) { if (!includeFile.exists() || !includeFile.canRead()) {
String msg = "The IncludeFile does not exist, or is not readable. Source model: {0} with IncludeFile: {1}"; //$NON-NLS-1$ String msg = "The IncludeFile does not exist, or is not readable. Source model: {0} with IncludeFile: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, this.modelFile.getName(), includeFileS); msg = MessageFormat.format(msg, this.modelFile.getName(), includeFileS);
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }
XmlModelSaxFileReader handler = new XmlModelSaxFileReader(this.listener, includeFile); XmlModelSaxFileReader handler = new XmlModelSaxFileReader(this.listener, includeFile);
handler.parseFile(); handler.parseFile();
this.statistics.nrOfOrders += handler.statistics.nrOfOrders; this.statistics.nrOfOrders += handler.statistics.nrOfOrders;
this.statistics.nrOfResources += handler.statistics.nrOfResources; this.statistics.nrOfResources += handler.statistics.nrOfResources;
break; break;
default: default:
super.startElement(uri, localName, qName, attributes); super.startElement(uri, localName, qName, attributes);
} }
} }

View File

@ -266,7 +266,7 @@ public class XmlModelSaxReader extends DefaultHandler {
case Tags.INCLUDE_FILE: case Tags.INCLUDE_FILE:
break; break;
case Tags.TIMED_STATE: case Tags.TIMED_STATE:
((Resource) this.parameterizedElement).addTimedState(state); ((Resource) this.parameterizedElement).addTimedState(this.state);
break; break;
case Tags.VALUE: case Tags.VALUE:
break; break;

View File

@ -15,7 +15,46 @@
*/ */
package li.strolch.model; package li.strolch.model;
import static li.strolch.model.ModelGenerator.*; import static li.strolch.model.ModelGenerator.BAG_ID;
import static li.strolch.model.ModelGenerator.BAG_NAME;
import static li.strolch.model.ModelGenerator.BAG_TYPE;
import static li.strolch.model.ModelGenerator.PARAM_BOOLEAN_ID;
import static li.strolch.model.ModelGenerator.PARAM_DATE_ID;
import static li.strolch.model.ModelGenerator.PARAM_FLOAT_ID;
import static li.strolch.model.ModelGenerator.PARAM_INTEGER_ID;
import static li.strolch.model.ModelGenerator.PARAM_LIST_STRING_ID;
import static li.strolch.model.ModelGenerator.PARAM_LONG_ID;
import static li.strolch.model.ModelGenerator.PARAM_STRING_ID;
import static li.strolch.model.ModelGenerator.STATE_BOOLEAN_ID;
import static li.strolch.model.ModelGenerator.STATE_BOOLEAN_TIME_0;
import static li.strolch.model.ModelGenerator.STATE_BOOLEAN_TIME_10;
import static li.strolch.model.ModelGenerator.STATE_BOOLEAN_TIME_20;
import static li.strolch.model.ModelGenerator.STATE_BOOLEAN_TIME_30;
import static li.strolch.model.ModelGenerator.STATE_FLOAT_ID;
import static li.strolch.model.ModelGenerator.STATE_FLOAT_TIME_0;
import static li.strolch.model.ModelGenerator.STATE_FLOAT_TIME_10;
import static li.strolch.model.ModelGenerator.STATE_FLOAT_TIME_20;
import static li.strolch.model.ModelGenerator.STATE_FLOAT_TIME_30;
import static li.strolch.model.ModelGenerator.STATE_INTEGER_ID;
import static li.strolch.model.ModelGenerator.STATE_INTEGER_TIME_0;
import static li.strolch.model.ModelGenerator.STATE_INTEGER_TIME_10;
import static li.strolch.model.ModelGenerator.STATE_INTEGER_TIME_20;
import static li.strolch.model.ModelGenerator.STATE_INTEGER_TIME_30;
import static li.strolch.model.ModelGenerator.STATE_STRING_ID;
import static li.strolch.model.ModelGenerator.STATE_STRING_TIME_0;
import static li.strolch.model.ModelGenerator.STATE_STRING_TIME_10;
import static li.strolch.model.ModelGenerator.STATE_STRING_TIME_20;
import static li.strolch.model.ModelGenerator.STATE_STRING_TIME_30;
import static li.strolch.model.ModelGenerator.STATE_TIME_0;
import static li.strolch.model.ModelGenerator.STATE_TIME_10;
import static li.strolch.model.ModelGenerator.STATE_TIME_20;
import static li.strolch.model.ModelGenerator.STATE_TIME_30;
import static li.strolch.model.ModelGenerator.createOrder;
import static li.strolch.model.ModelGenerator.createResource;
import static li.strolch.model.Tags.BAG;
import static li.strolch.model.Tags.ORDER;
import static li.strolch.model.Tags.RESOURCE;
import static li.strolch.model.Tags.STATE;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
@ -23,7 +62,7 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import static li.strolch.model.Tags.*;
import li.strolch.model.parameter.BooleanParameter; import li.strolch.model.parameter.BooleanParameter;
import li.strolch.model.parameter.DateParameter; import li.strolch.model.parameter.DateParameter;
import li.strolch.model.parameter.FloatParameter; import li.strolch.model.parameter.FloatParameter;

View File

@ -15,11 +15,12 @@
*/ */
package li.strolch.model; package li.strolch.model;
import static org.junit.Assert.assertTrue;
import li.strolch.model.visitor.OrderDeepEqualsVisitor; import li.strolch.model.visitor.OrderDeepEqualsVisitor;
import li.strolch.model.visitor.ResourceDeepEqualsVisitor; import li.strolch.model.visitor.ResourceDeepEqualsVisitor;
import li.strolch.model.xml.OrderToDomVisitor; import li.strolch.model.xml.OrderToDomVisitor;
import li.strolch.model.xml.ResourceToDomVisitor; import li.strolch.model.xml.ResourceToDomVisitor;
import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -45,8 +46,7 @@ public class XmlToDomTest extends ModelTest {
OrderDeepEqualsVisitor visitor = new OrderDeepEqualsVisitor(order); OrderDeepEqualsVisitor visitor = new OrderDeepEqualsVisitor(order);
visitor.visit(parsedOrder); visitor.visit(parsedOrder);
assertTrue("To DOM and back should equal same Order:\n" + visitor.getMismatchedLocators(), assertTrue("To DOM and back should equal same Order:\n" + visitor.getMismatchedLocators(), visitor.isEqual());
visitor.isEqual());
} }
@Test @Test
@ -63,7 +63,6 @@ public class XmlToDomTest extends ModelTest {
ResourceDeepEqualsVisitor visitor = new ResourceDeepEqualsVisitor(resource); ResourceDeepEqualsVisitor visitor = new ResourceDeepEqualsVisitor(resource);
visitor.visit(parsedResource); visitor.visit(parsedResource);
assertTrue("To DOM and back should equal same Resource:\n" + visitor.getMismatchedLocators(), assertTrue("To DOM and back should equal same Resource:\n" + visitor.getMismatchedLocators(), visitor.isEqual());
visitor.isEqual());
} }
} }

View File

@ -15,8 +15,11 @@
*/ */
package li.strolch.model.timedstate; package li.strolch.model.timedstate;
import static org.junit.Assert.assertEquals;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import li.strolch.model.ModelGenerator; import li.strolch.model.ModelGenerator;
import li.strolch.model.Resource; import li.strolch.model.Resource;
import li.strolch.model.timevalue.ITimeValue; import li.strolch.model.timevalue.ITimeValue;
@ -25,7 +28,7 @@ import li.strolch.model.timevalue.impl.BooleanValue;
import li.strolch.model.timevalue.impl.FloatValue; import li.strolch.model.timevalue.impl.FloatValue;
import li.strolch.model.timevalue.impl.IntegerValue; import li.strolch.model.timevalue.impl.IntegerValue;
import li.strolch.model.timevalue.impl.StringSetValue; import li.strolch.model.timevalue.impl.StringSetValue;
import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Test;
/** /**