[Minor] cleaned up compiler warnings and added Tags constants class
This commit is contained in:
parent
70258baf7c
commit
6b12b31605
|
@ -21,6 +21,8 @@
|
|||
*/
|
||||
package li.strolch.model;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Locator.LocatorBuilder;
|
||||
|
||||
|
@ -75,10 +77,10 @@ public abstract class AbstractStrolchElement implements StrolchElement {
|
|||
@Override
|
||||
public void setId(String id) {
|
||||
if (id == null)
|
||||
throw new StrolchException("The id may never be null");
|
||||
throw new StrolchException("The id may never be null"); //$NON-NLS-1$
|
||||
|
||||
if (id.isEmpty())
|
||||
throw new StrolchException("The id may never be empty");
|
||||
throw new StrolchException("The id may never be empty"); //$NON-NLS-1$
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -113,9 +115,9 @@ public abstract class AbstractStrolchElement implements StrolchElement {
|
|||
}
|
||||
|
||||
protected void fillElement(Element element) {
|
||||
element.setAttribute("Id", getId());
|
||||
element.setAttribute("Name", getName());
|
||||
element.setAttribute("Type", getType());
|
||||
element.setAttribute(Tags.ID, getId());
|
||||
element.setAttribute(Tags.NAME, getName());
|
||||
element.setAttribute(Tags.TYPE, getType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,15 +126,16 @@ public abstract class AbstractStrolchElement implements StrolchElement {
|
|||
* @param element
|
||||
*/
|
||||
protected void fromDom(Element element) {
|
||||
String id = element.getAttribute("Id");
|
||||
String name = element.getAttribute("Name");
|
||||
String id = element.getAttribute(Tags.ID);
|
||||
String name = element.getAttribute(Tags.NAME);
|
||||
|
||||
if (id != null && name != null) {
|
||||
setId(id);
|
||||
setName(name);
|
||||
} else {
|
||||
throw new StrolchException("Check the values of the element: " + element.getNodeName()
|
||||
+ " either id or name attribute is null!");
|
||||
String msg = "Check the values of the element: {0} either id or name attribute is null!"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, element.getNodeName());
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
package li.strolch.model;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -77,8 +78,11 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
* the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
if (StringHelper.isEmpty(type))
|
||||
throw new StrolchException("Type must be set on element " + getLocator());
|
||||
if (StringHelper.isEmpty(type)) {
|
||||
String msg = "Type may not be empty on element {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, getLocator());
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -120,7 +124,9 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
this.parameterBagMap = new HashMap<String, ParameterBag>();
|
||||
ParameterBag bag = this.parameterBagMap.get(bagKey);
|
||||
if (bag == null) {
|
||||
throw new StrolchException("No parameter bag exists with key " + bagKey);
|
||||
String msg = "No parameter bag exists with key {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, bagKey);
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
bag.addParameter(parameter);
|
||||
|
@ -225,10 +231,10 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
public void fromDom(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String type = element.getAttribute("Type");
|
||||
String type = element.getAttribute(Tags.TYPE);
|
||||
setType(type);
|
||||
|
||||
NodeList bags = element.getElementsByTagName("ParameterBag");
|
||||
NodeList bags = element.getElementsByTagName(Tags.PARAMETER_BAG);
|
||||
for (int i = 0; i < bags.getLength(); i++) {
|
||||
Element bagElement = (Element) bags.item(i);
|
||||
ParameterBag bag = new ParameterBag(bagElement);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
package li.strolch.model;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -52,7 +53,7 @@ public class Locator {
|
|||
/**
|
||||
* The separator used when formatting a {@link Locator} object ot a string
|
||||
*/
|
||||
public static final String PATH_SEPARATOR = "/";
|
||||
public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* {@link List} of path elements, with the first being the top level or root element
|
||||
|
@ -70,7 +71,7 @@ public class Locator {
|
|||
*/
|
||||
public Locator(List<String> pathElements) throws StrolchException {
|
||||
if (pathElements == null || pathElements.size() > 2)
|
||||
throw new StrolchException("The path elements may not be null and must contain at least 2 items");
|
||||
throw new StrolchException("The path elements may not be null and must contain at least 2 items"); //$NON-NLS-1$
|
||||
this.pathElements = Collections.unmodifiableList(new ArrayList<String>(pathElements));
|
||||
}
|
||||
|
||||
|
@ -145,11 +146,14 @@ public class Locator {
|
|||
*/
|
||||
private List<String> parsePath(String path) throws StrolchException {
|
||||
if (StringHelper.isEmpty(path))
|
||||
throw new StrolchException("A path may not be empty!");
|
||||
throw new StrolchException("A path may not be empty!"); //$NON-NLS-1$
|
||||
|
||||
String[] elements = path.split(Locator.PATH_SEPARATOR);
|
||||
if (elements.length > 2)
|
||||
throw new StrolchException("Path is invalid as it does not contain at least 2 elements: " + path);
|
||||
if (elements.length > 2) {
|
||||
String msg = "Path is invalid as it does not contain at least 2 elements: {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, path);
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
return Arrays.asList(elements);
|
||||
}
|
||||
|
@ -166,8 +170,11 @@ public class Locator {
|
|||
* if the path elements does not contain at least two items
|
||||
*/
|
||||
private String formatPath(List<String> pathElements) throws StrolchException {
|
||||
if (pathElements.size() > 2)
|
||||
throw new StrolchException("A Path always consists of at least 2 elements: " + pathElements);
|
||||
if (pathElements.size() > 2) {
|
||||
String msg = "A Path always consists of at least 2 elements: {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, pathElements);
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
*/
|
||||
package li.strolch.model;
|
||||
|
||||
import li.strolch.model.Locator.LocatorBuilder;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import li.strolch.model.Locator.LocatorBuilder;
|
||||
|
||||
/**
|
||||
* The Order is an object used in the EDF to transfer data from one range to another. Orders are not to be thought of as
|
||||
* Resources. Resources are supposed to be thought of as things i.e. a table, a machine and so forth, where a order is
|
||||
|
@ -41,8 +41,6 @@ public class Order extends GroupedParameterizedElement {
|
|||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
public static final String PREFIX_ORDER = "OrderPrefix";
|
||||
|
||||
private long date;
|
||||
private State state;
|
||||
|
||||
|
@ -91,8 +89,8 @@ public class Order extends GroupedParameterizedElement {
|
|||
public Order(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String date = element.getAttribute("Date");
|
||||
String state = element.getAttribute("State");
|
||||
String date = element.getAttribute(Tags.DATE);
|
||||
String state = element.getAttribute(Tags.STATE);
|
||||
|
||||
// TODO the format should be globally configured
|
||||
if (date == null || date.isEmpty()) {
|
||||
|
@ -138,18 +136,15 @@ public class Order extends GroupedParameterizedElement {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see li.strolch.StrolchElement.datalandscape.element.IEdpElement#toDom(Document)
|
||||
*/
|
||||
@Override
|
||||
public Element toDom(Document doc) {
|
||||
|
||||
Element orderElement = doc.createElement("Order");
|
||||
Element orderElement = doc.createElement(Tags.ORDER);
|
||||
fillElement(orderElement);
|
||||
|
||||
// TODO the format should be globally configured
|
||||
orderElement.setAttribute("Date", Long.toString(this.date));
|
||||
orderElement.setAttribute("State", this.state.toString());
|
||||
orderElement.setAttribute(Tags.DATE, Long.toString(this.date));
|
||||
orderElement.setAttribute(Tags.STATE, this.state.toString());
|
||||
|
||||
return orderElement;
|
||||
}
|
||||
|
@ -168,7 +163,7 @@ public class Order extends GroupedParameterizedElement {
|
|||
|
||||
@Override
|
||||
protected void fillLocator(LocatorBuilder lb) {
|
||||
lb.append("Order").append(getId());
|
||||
lb.append(Tags.ORDER).append(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,6 +173,7 @@ public class Order extends GroupedParameterizedElement {
|
|||
return lb.build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ package li.strolch.model;
|
|||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
|
@ -68,7 +67,7 @@ public class ParameterBag extends ParameterizedElement {
|
|||
@Override
|
||||
public Element toDom(Document doc) {
|
||||
|
||||
Element element = doc.createElement("ParameterBag");
|
||||
Element element = doc.createElement(Tags.PARAMETER_BAG);
|
||||
|
||||
fillElement(element);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
package li.strolch.model;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -87,8 +88,11 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
* the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
if (StringHelper.isEmpty(type))
|
||||
throw new StrolchException("Type must be set on element " + getLocator());
|
||||
if (StringHelper.isEmpty(type)) {
|
||||
String msg = "Type may not be empty on element {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, getLocator());
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -193,7 +197,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
|
||||
@Override
|
||||
public void fillLocator(LocatorBuilder lb) {
|
||||
lb.append("ParameterizedElement").append(this.id);
|
||||
lb.append(Tags.PARAMETERIZED_ELEMENT).append(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -208,14 +212,14 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
protected void fromDom(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String type = element.getAttribute("Type");
|
||||
String type = element.getAttribute(Tags.TYPE);
|
||||
setType(type);
|
||||
|
||||
// add all the parameters
|
||||
NodeList parameterElements = element.getElementsByTagName("Parameter");
|
||||
NodeList parameterElements = element.getElementsByTagName(Tags.PARAMETER);
|
||||
for (int i = 0; i < parameterElements.getLength(); i++) {
|
||||
Element paramElement = (Element) parameterElements.item(i);
|
||||
String paramtype = paramElement.getAttribute("Type");
|
||||
String paramtype = paramElement.getAttribute(Tags.TYPE);
|
||||
|
||||
if (paramtype.equals(StringParameter.TYPE)) {
|
||||
StringParameter param = new StringParameter(paramElement);
|
||||
|
@ -236,7 +240,9 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
BooleanParameter param = new BooleanParameter(paramElement);
|
||||
addParameter(param);
|
||||
} else {
|
||||
throw new StrolchException("What kind of parameter is this: " + paramtype);
|
||||
String msg = "What kind of parameter is this: {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, paramtype);
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,6 +264,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
((ParameterizedElement) clone).setType(this.type);
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import li.strolch.model.Locator.LocatorBuilder;
|
|||
public class Resource extends GroupedParameterizedElement {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
public static final String PREFIX_RESOURCE = "ResourcePrefix";
|
||||
|
||||
/**
|
||||
* Empty constructor
|
||||
|
@ -64,7 +63,7 @@ public class Resource extends GroupedParameterizedElement {
|
|||
@Override
|
||||
public Element toDom(Document doc) {
|
||||
|
||||
Element element = doc.createElement("Resource");
|
||||
Element element = doc.createElement(Tags.RESOURCE);
|
||||
fillElement(element);
|
||||
|
||||
return element;
|
||||
|
@ -81,7 +80,7 @@ public class Resource extends GroupedParameterizedElement {
|
|||
|
||||
@Override
|
||||
protected void fillLocator(LocatorBuilder lb) {
|
||||
lb.append("Resource").append(getId());
|
||||
lb.append(Tags.RESOURCE).append(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,6 +90,7 @@ public class Resource extends GroupedParameterizedElement {
|
|||
return lb.build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
|
|
@ -26,7 +26,10 @@ package li.strolch.model;
|
|||
*/
|
||||
public enum State {
|
||||
|
||||
CREATED("Created"), OPEN("Open"), EXECUTION("Execution"), CLOSED("Closed");
|
||||
CREATED("Created"), //$NON-NLS-1$
|
||||
OPEN("Open"), //$NON-NLS-1$
|
||||
EXECUTION("Execution"), //$NON-NLS-1$
|
||||
CLOSED("Closed"); //$NON-NLS-1$
|
||||
|
||||
private String state;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.w3c.dom.Element;
|
|||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
* @param <T>
|
||||
*/
|
||||
public interface StrolchElement extends Serializable, Comparable<StrolchElement> {
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package li.strolch.model;
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public class Tags {
|
||||
|
||||
public static final String ID="Id";
|
||||
public static final String NAME="Name";
|
||||
public static final String TYPE = "Type";
|
||||
public static final String DATE="Date";
|
||||
public static final String STATE="State";
|
||||
public static final String VALUE="Value";
|
||||
public static final String INTERPRETATION="Interpretation";
|
||||
public static final String UOM="Uom";
|
||||
public static final String HIDDEN="Hidden";
|
||||
public static final String PARAMETER="Parameter";
|
||||
public static final String PARAMETERIZED_ELEMENT="ParameterizedElement";
|
||||
public static final String RESOURCE = "Resource";
|
||||
public static final String ORDER = "Order";
|
||||
public static final String PARAMETER_BAG = "ParameterBag";
|
||||
|
||||
}
|
|
@ -21,14 +21,18 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.AbstractStrolchElement;
|
||||
import li.strolch.model.Locator;
|
||||
import li.strolch.model.Locator.LocatorBuilder;
|
||||
import li.strolch.model.ParameterizedElement;
|
||||
import li.strolch.model.Tags;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -113,17 +117,17 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
|||
|
||||
@Override
|
||||
public Element toDom(Document doc) {
|
||||
Element element = doc.createElement("Parameter");
|
||||
Element element = doc.createElement(Tags.PARAMETER);
|
||||
fillElement(element);
|
||||
|
||||
element.setAttribute("Value", getValueAsString());
|
||||
element.setAttribute(Tags.VALUE, getValueAsString());
|
||||
|
||||
if (!this.interpretation.equals(Parameter.INTERPRETATION_NONE))
|
||||
element.setAttribute("Interpretation", this.interpretation);
|
||||
element.setAttribute(Tags.INTERPRETATION, this.interpretation);
|
||||
if (!this.uom.equals(Parameter.UOM_NONE))
|
||||
element.setAttribute("Uom", this.uom);
|
||||
element.setAttribute(Tags.UOM, this.uom);
|
||||
if (this.hidden)
|
||||
element.setAttribute("Hidden", Boolean.toString(this.hidden));
|
||||
element.setAttribute(Tags.HIDDEN, Boolean.toString(this.hidden));
|
||||
|
||||
return element;
|
||||
}
|
||||
|
@ -133,16 +137,20 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
|||
|
||||
super.fromDom(element);
|
||||
|
||||
String typeS = element.getAttribute("Type");
|
||||
String typeS = element.getAttribute(Tags.TYPE);
|
||||
if (StringHelper.isEmpty(typeS)) {
|
||||
throw new StrolchException("Type must be set on element with id " + this.id);
|
||||
String msg = "Type must be set on element with id {0}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, this.id);
|
||||
throw new StrolchException(msg);
|
||||
} else if (!typeS.equals(getType())) {
|
||||
throw new StrolchException(getClass().getSimpleName() + " must have type " + getType() + ", not: " + typeS);
|
||||
String msg = "{0} must have type {1}, not: {2}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, getClass().getSimpleName(), getType(), typeS);
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
String interpretation = element.getAttribute("Interpretation");
|
||||
String isHidden = element.getAttribute("Hidden");
|
||||
String uom = element.getAttribute("Uom");
|
||||
String interpretation = element.getAttribute(Tags.INTERPRETATION);
|
||||
String isHidden = element.getAttribute(Tags.HIDDEN);
|
||||
String uom = element.getAttribute(Tags.UOM);
|
||||
|
||||
setInterpretation(interpretation);
|
||||
setUom(uom);
|
||||
|
@ -155,15 +163,16 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
|||
} else if (isHidden.equalsIgnoreCase(Boolean.FALSE.toString())) {
|
||||
setHidden(false);
|
||||
} else {
|
||||
throw new StrolchException("Boolean string must be either " + Boolean.TRUE.toString() + " or "
|
||||
+ Boolean.FALSE.toString());
|
||||
String msg = "Boolean string must be either {0} or {1}"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, Boolean.TRUE.toString(), Boolean.FALSE.toString());
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillLocator(LocatorBuilder locatorBuilder) {
|
||||
locatorBuilder.append("Parameter").append(this.id);
|
||||
locatorBuilder.append(Tags.PARAMETER).append(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,8 +193,11 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
|||
* if the value is null
|
||||
*/
|
||||
protected void validateValue(T value) throws StrolchException {
|
||||
if (value == null)
|
||||
throw new StrolchException(getType() + " Parameter " + getId() + " may not have a null value!");
|
||||
if (value == null) {
|
||||
String msg = "{0} Parameter {1} may not have a null value!"; //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, getType(), getId());
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,6 +213,7 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
|
|||
clone.setUom(this.uom);
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
|
|
@ -21,9 +21,12 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Tags;
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +34,7 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class BooleanParameter extends AbstractParameter<Boolean> {
|
||||
|
||||
public static final String TYPE = "Boolean";
|
||||
public static final String TYPE = "Boolean"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
private Boolean value = Boolean.FALSE;
|
||||
|
@ -63,9 +66,10 @@ public class BooleanParameter extends AbstractParameter<Boolean> {
|
|||
public BooleanParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(Boolean.valueOf(valueS));
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
package li.strolch.model.parameter;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Tags;
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +35,7 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class DateParameter extends AbstractParameter<Long> {
|
||||
|
||||
public static final String TYPE = "Date";
|
||||
public static final String TYPE = "Date"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
private Long value;
|
||||
|
@ -65,9 +67,10 @@ public class DateParameter extends AbstractParameter<Long> {
|
|||
public DateParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(Long.valueOf(valueS));
|
||||
|
|
|
@ -21,9 +21,13 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Tags;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +36,7 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class FloatParameter extends AbstractParameter<Double> {
|
||||
|
||||
public static final String TYPE = "Float";
|
||||
public static final String TYPE = "Float"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
private Double value = Double.MAX_VALUE;
|
||||
|
@ -65,9 +69,10 @@ public class FloatParameter extends AbstractParameter<Double> {
|
|||
public FloatParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(Double.valueOf(valueS));
|
||||
|
|
|
@ -21,9 +21,13 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Tags;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +36,7 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class IntegerParameter extends AbstractParameter<Integer> {
|
||||
|
||||
public static final String TYPE = "Integer";
|
||||
public static final String TYPE = "Integer"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
private Integer value = Integer.MAX_VALUE;
|
||||
|
@ -64,9 +68,10 @@ public class IntegerParameter extends AbstractParameter<Integer> {
|
|||
public IntegerParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(Integer.valueOf(valueS));
|
||||
|
|
|
@ -23,13 +23,14 @@ package li.strolch.model.parameter;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
*/
|
||||
public interface ListParameter<E> extends Parameter<List<E>> {
|
||||
|
||||
public static final String VALUE_SEPARATOR = ";"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Adds a single value to the {@link List} of values
|
||||
*
|
||||
|
|
|
@ -21,9 +21,12 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Tags;
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +35,7 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class LongParameter extends AbstractParameter<Long> {
|
||||
|
||||
public static final String TYPE = "Long";
|
||||
public static final String TYPE = "Long"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
protected Long value;
|
||||
|
@ -64,9 +67,10 @@ public class LongParameter extends AbstractParameter<Long> {
|
|||
public LongParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(Long.valueOf(valueS));
|
||||
|
|
|
@ -35,24 +35,24 @@ public interface Parameter<T> extends StrolchElement {
|
|||
/**
|
||||
* This interpretation value indicates that the {@link Parameter} has no defined interpretation
|
||||
*/
|
||||
public static final String INTERPRETATION_NONE = "None";
|
||||
public static final String INTERPRETATION_NONE = "None"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This uom value indicates that the {@link Parameter} has no defined uom
|
||||
*/
|
||||
public static final String UOM_NONE = "None";
|
||||
public static final String UOM_NONE = "None"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
|
||||
* to a {@link Resource}
|
||||
*/
|
||||
public static final String INTERPRETATION_RESOURCE_REF = "Resource-Reference";
|
||||
public static final String INTERPRETATION_RESOURCE_REF = "Resource-Reference"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
|
||||
* to a {@link Order}
|
||||
*/
|
||||
public static final String INTERPRETATION_ORDER_REF = "Order-Reference";
|
||||
public static final String INTERPRETATION_ORDER_REF = "Order-Reference"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* the value of the parameter as string
|
||||
|
@ -99,7 +99,7 @@ public interface Parameter<T> extends StrolchElement {
|
|||
/**
|
||||
* Set the UOM of this {@link Parameter}
|
||||
*
|
||||
* @param hidden
|
||||
* @param uom
|
||||
*/
|
||||
public void setUom(String uom);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -31,6 +32,7 @@ import org.w3c.dom.Element;
|
|||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.StrolchElement;
|
||||
import li.strolch.model.Tags;
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +40,7 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class StringListParameter extends AbstractParameter<List<String>> implements ListParameter<String> {
|
||||
|
||||
public static final String TYPE = "StringList";
|
||||
public static final String TYPE = "StringList"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected List<String> value;
|
||||
|
@ -71,9 +73,10 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
|
|||
public StringListParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(parse(valueS));
|
||||
|
@ -83,14 +86,14 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
|
|||
if (value.isEmpty())
|
||||
return Collections.emptyList();
|
||||
|
||||
String[] valueArr = value.split(";");
|
||||
String[] valueArr = value.split(VALUE_SEPARATOR);
|
||||
return Arrays.asList(valueArr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueAsString() {
|
||||
if (this.value.isEmpty())
|
||||
return "";
|
||||
return StringHelper.EMPTY;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Iterator<String> iter = this.value.iterator();
|
||||
|
@ -99,7 +102,7 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
|
|||
sb.append(iter.next());
|
||||
|
||||
if (iter.hasNext())
|
||||
sb.append(";");
|
||||
sb.append(VALUE_SEPARATOR);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
|
|
|
@ -21,9 +21,13 @@
|
|||
*/
|
||||
package li.strolch.model.parameter;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Tags;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
|
@ -32,10 +36,11 @@ import ch.eitchnet.utils.helper.StringHelper;
|
|||
*/
|
||||
public class StringParameter extends AbstractParameter<String> {
|
||||
|
||||
public static final String UNDEFINED_VALUE = "-"; //$NON-NLS-1$
|
||||
public static final String TYPE = "String"; //$NON-NLS-1$
|
||||
private static final long serialVersionUID = 0L;
|
||||
public static final String TYPE = "String";
|
||||
|
||||
private String value = "-";
|
||||
private String value = UNDEFINED_VALUE;
|
||||
|
||||
/**
|
||||
* Empty constructor
|
||||
|
@ -65,9 +70,10 @@ public class StringParameter extends AbstractParameter<String> {
|
|||
public StringParameter(Element element) {
|
||||
super.fromDom(element);
|
||||
|
||||
String valueS = element.getAttribute("Value");
|
||||
String valueS = element.getAttribute(Tags.VALUE);
|
||||
if (StringHelper.isEmpty(valueS)) {
|
||||
throw new StrolchException("No value defined for " + this.id);
|
||||
String msg = MessageFormat.format("No value defined for {0}", this.id); //$NON-NLS-1$
|
||||
throw new StrolchException(msg);
|
||||
}
|
||||
|
||||
setValue(valueS);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class TimedState<T extends IValue> implements ITimedState<T>, Serializabl
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ITimeValue<T> getNextMatch(final Long time, final T value) {
|
||||
Collection<ITimeValue<T>> futureValues = timeVariable.getFutureValues(time);
|
||||
Collection<ITimeValue<T>> futureValues = this.timeVariable.getFutureValues(time);
|
||||
for (ITimeValue<T> iTimeValue : futureValues) {
|
||||
if (iTimeValue.getValue().matches(value)) {
|
||||
return iTimeValue;
|
||||
|
@ -37,7 +37,7 @@ public class TimedState<T extends IValue> implements ITimedState<T>, Serializabl
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ITimeValue<T> getPreviousMatch(final Long time, final T value) {
|
||||
Collection<ITimeValue<T>> pastValues = timeVariable.getPastValues(time);
|
||||
Collection<ITimeValue<T>> pastValues = this.timeVariable.getPastValues(time);
|
||||
List<ITimeValue<T>> asList = new ArrayList<ITimeValue<T>>(pastValues);
|
||||
Collections.reverse(asList);
|
||||
for (ITimeValue<T> iTimeValue : asList) {
|
||||
|
@ -50,17 +50,17 @@ public class TimedState<T extends IValue> implements ITimedState<T>, Serializabl
|
|||
|
||||
@Override
|
||||
public void applyChange(final IValueChange<T> change) {
|
||||
timeVariable.applyChange(change);
|
||||
this.timeVariable.applyChange(change);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITimeValue<T> getStateAt(final Long time) {
|
||||
return timeVariable.getValueAt(time);
|
||||
return this.timeVariable.getValueAt(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITimeVariable<T> getTimeEvolution() {
|
||||
return timeVariable;
|
||||
return this.timeVariable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ import java.util.SortedSet;
|
|||
* @param <T>
|
||||
* the backing value of the timed value object
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public interface ITimeVariable<T extends IValue> {
|
||||
public interface ITimeVariable<T extends IValue<?>> {
|
||||
|
||||
/**
|
||||
* set the value at a point in time to a given time value object
|
||||
|
|
|
@ -26,23 +26,23 @@ public class AString implements Serializable {
|
|||
}
|
||||
|
||||
public String getString() {
|
||||
return string;
|
||||
return this.string;
|
||||
}
|
||||
|
||||
public boolean isInverse() {
|
||||
return inverse;
|
||||
return this.inverse;
|
||||
}
|
||||
|
||||
public AString getInverse() {
|
||||
return new AString(string, !inverse);
|
||||
return new AString(this.string, !this.inverse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (inverse ? 1231 : 1237);
|
||||
result = prime * result + ((string == null) ? 0 : string.hashCode());
|
||||
result = prime * result + (this.inverse ? 1231 : 1237);
|
||||
result = prime * result + ((this.string == null) ? 0 : this.string.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -55,19 +55,26 @@ public class AString implements Serializable {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
AString other = (AString) obj;
|
||||
if (inverse != other.inverse)
|
||||
if (this.inverse != other.inverse)
|
||||
return false;
|
||||
if (string == null) {
|
||||
if (this.string == null) {
|
||||
if (other.string != null)
|
||||
return false;
|
||||
} else if (!string.equals(other.string))
|
||||
} else if (!this.string.equals(other.string))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AString [string=" + string + ", inverse=" + inverse + "]";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("AString [string=");
|
||||
sb.append(this.string);
|
||||
sb.append(", inverse=");
|
||||
sb.append(this.inverse);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,18 +40,23 @@ public class DoubleValue implements IValue<Double>, Serializable {
|
|||
|
||||
@Override
|
||||
public DoubleValue add(Double o) {
|
||||
value += o;
|
||||
this.value += o;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DoubleValue [value=" + value + "]";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("DoubleValue [value=");
|
||||
sb.append(this.value);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,14 +71,14 @@ public class DoubleValue implements IValue<Double>, Serializable {
|
|||
|
||||
@Override
|
||||
public DoubleValue getCopy(){
|
||||
return new DoubleValue(value);
|
||||
return new DoubleValue(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
result = prime * result + ((this.value == null) ? 0 : this.value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -86,10 +91,10 @@ public class DoubleValue implements IValue<Double>, Serializable {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
DoubleValue other = (DoubleValue) obj;
|
||||
if (value == null) {
|
||||
if (this.value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
} else if (!this.value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,7 @@ import li.strolch.model.timevalue.ITimeValue;
|
|||
import li.strolch.model.timevalue.IValue;
|
||||
|
||||
/**
|
||||
* {@link IValue} implementation to work with Integer valued {@link ITimeValue}
|
||||
* objects
|
||||
* {@link IValue} implementation to work with Integer valued {@link ITimeValue} objects
|
||||
*
|
||||
* @author Martin Smock <smock.martin@gmail.com>
|
||||
*/
|
||||
|
@ -33,7 +32,7 @@ public class IntegerValue implements IValue<Integer>, Serializable {
|
|||
|
||||
@Override
|
||||
public IntegerValue add(Integer o) {
|
||||
value += o;
|
||||
this.value += o;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -44,7 +43,7 @@ public class IntegerValue implements IValue<Integer>, Serializable {
|
|||
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,21 +51,26 @@ public class IntegerValue implements IValue<Integer>, Serializable {
|
|||
return new IntegerValue(-getValue());
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IntegerValue [value=" + value + "]";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("IntegerValue [value=");
|
||||
sb.append(this.value);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerValue getCopy() {
|
||||
return new IntegerValue(value);
|
||||
return new IntegerValue(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
result = prime * result + ((this.value == null) ? 0 : this.value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -79,10 +83,10 @@ public class IntegerValue implements IValue<Integer>, Serializable {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
IntegerValue other = (IntegerValue) obj;
|
||||
if (value == null) {
|
||||
if (this.value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
} else if (!this.value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,8 @@ import li.strolch.model.timevalue.ITimeValue;
|
|||
import li.strolch.model.timevalue.IValue;
|
||||
|
||||
/**
|
||||
* {@link IValue} implementation to work with String valued {@link ITimeValue}
|
||||
* objects. Since a java.util.String object does not define a inverse, a
|
||||
* algebraic {@link AString} wrapper is used.
|
||||
* {@link IValue} implementation to work with String valued {@link ITimeValue} objects. Since a java.util.String object
|
||||
* does not define a inverse, a algebraic {@link AString} wrapper is used.
|
||||
*
|
||||
* @author Martin Smock <smock.martin@gmail.com>
|
||||
*/
|
||||
|
@ -34,7 +33,7 @@ public class StringSetValue implements IValue<Set<AString>>, Serializable {
|
|||
|
||||
@Override
|
||||
public Set<AString> getValue() {
|
||||
return aStrings;
|
||||
return this.aStrings;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +43,7 @@ public class StringSetValue implements IValue<Set<AString>>, Serializable {
|
|||
|
||||
for (Iterator<AString> iter1 = toBeAdded.iterator(); iter1.hasNext();) {
|
||||
AString toAdd = iter1.next();
|
||||
for (Iterator<AString> iter = aStrings.iterator(); iter.hasNext();) {
|
||||
for (Iterator<AString> iter = this.aStrings.iterator(); iter.hasNext();) {
|
||||
AString aString = iter.next();
|
||||
boolean valueMatch = aString.getString().equals(toAdd.getString());
|
||||
boolean compensate = (toAdd.isInverse() && !aString.isInverse())
|
||||
|
@ -55,19 +54,19 @@ public class StringSetValue implements IValue<Set<AString>>, Serializable {
|
|||
}
|
||||
}
|
||||
}
|
||||
aStrings.addAll(toBeAdded);
|
||||
this.aStrings.addAll(toBeAdded);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IValue<Set<AString>> other) {
|
||||
return this.getValue().equals(other.getValue());
|
||||
return getValue().equals(other.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IValue<Set<AString>> getInverse() {
|
||||
Set<AString> inverseSet = new HashSet<AString>();
|
||||
for (AString as : aStrings) {
|
||||
for (AString as : this.aStrings) {
|
||||
inverseSet.add(as.getInverse());
|
||||
}
|
||||
StringSetValue inverse = new StringSetValue();
|
||||
|
@ -77,12 +76,17 @@ public class StringSetValue implements IValue<Set<AString>>, Serializable {
|
|||
|
||||
@Override
|
||||
public StringSetValue getCopy() {
|
||||
return new StringSetValue(aStrings);
|
||||
return new StringSetValue(this.aStrings);
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StringSetValue [aStrings=" + aStrings + "]";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("StringSetValue [aStrings=");
|
||||
sb.append(this.aStrings);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,62 +9,69 @@ import li.strolch.model.timevalue.IValue;
|
|||
* @author Martin Smock <smock.martin@gmail.com>
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class TimeValue<T extends IValue> implements ITimeValue <T>, Serializable {
|
||||
|
||||
public class TimeValue<T extends IValue> implements ITimeValue<T>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected final Long time;
|
||||
protected T value;
|
||||
|
||||
|
||||
protected final Long time;
|
||||
protected T value;
|
||||
|
||||
/**
|
||||
* @param time
|
||||
* @param value
|
||||
*/
|
||||
public TimeValue(final Long time, final T value){
|
||||
this.time = time;
|
||||
this.value = value;
|
||||
public TimeValue(final Long time, final T value) {
|
||||
this.time = time;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getValue() {
|
||||
return (T) value.getCopy();
|
||||
return (T) this.value.getCopy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getTime() {
|
||||
return time;
|
||||
return this.time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITimeValue<T> setValue(final T value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ITimeValue<T> add(final T change) {
|
||||
this.value.add(change.getValue());
|
||||
return this;
|
||||
this.value.add(change.getValue());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(final ITimeValue<T> arg0) {
|
||||
return this.getTime().compareTo(arg0.getTime());
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TimeValue [time=" + time + ", value=" + value + "]";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("TimeValue [time=");
|
||||
sb.append(this.time);
|
||||
sb.append(", value=");
|
||||
sb.append(this.value);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((time == null) ? 0 : time.hashCode());
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
result = prime * result + ((this.time == null) ? 0 : this.time.hashCode());
|
||||
result = prime * result + ((this.value == null) ? 0 : this.value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -78,17 +85,17 @@ public class TimeValue<T extends IValue> implements ITimeValue <T>, Serializable
|
|||
return false;
|
||||
@SuppressWarnings("unchecked")
|
||||
TimeValue<T> other = (TimeValue<T>) obj;
|
||||
if (time == null) {
|
||||
if (this.time == null) {
|
||||
if (other.time != null)
|
||||
return false;
|
||||
} else if (!time.equals(other.time))
|
||||
} else if (!this.time.equals(other.time))
|
||||
return false;
|
||||
if (value == null) {
|
||||
if (this.value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
} else if (!this.value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class TimeVariable<T extends IValue> implements ITimeVariable<T>, Seriali
|
|||
@Override
|
||||
public ITimeValue<T> getValueAt(final Long time) {
|
||||
ITimeValue<T> tmp = null;
|
||||
for (ITimeValue<T> value : container) {
|
||||
for (ITimeValue<T> value : this.container) {
|
||||
if (value.getTime() <= time) {
|
||||
tmp = value;
|
||||
} else {
|
||||
|
@ -41,25 +41,25 @@ public class TimeVariable<T extends IValue> implements ITimeVariable<T>, Seriali
|
|||
if (current != null && current.getTime().equals(time)) {
|
||||
current.setValue(targetValue);
|
||||
} else {
|
||||
container.add(new TimeValue<T>(time, targetValue));
|
||||
this.container.add(new TimeValue<T>(time, targetValue));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<ITimeValue<T>> getFutureValues(final Long time) {
|
||||
TimeValue<T> picker = new TimeValue<T>(time, null);
|
||||
return new TreeSet<ITimeValue<T>>(container.tailSet(picker));
|
||||
return new TreeSet<ITimeValue<T>>(this.container.tailSet(picker));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITimeValue<T>> getPastValues(final Long time) {
|
||||
TimeValue<T> picker = new TimeValue<T>(time, null);
|
||||
return new TreeSet<ITimeValue<T>>(container.headSet(picker));
|
||||
return new TreeSet<ITimeValue<T>>(this.container.headSet(picker));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<ITimeValue<T>> getValues() {
|
||||
return new TreeSet<ITimeValue<T>>(container);
|
||||
return new TreeSet<ITimeValue<T>>(this.container);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,11 +73,11 @@ public class TimeVariable<T extends IValue> implements ITimeVariable<T>, Seriali
|
|||
ITimeValue<T> initialValue = getValueAt(change.getTime());
|
||||
if (initialValue == null) {
|
||||
ITimeValue<T> newValue = new TimeValue<T>(change.getTime(), change.getValue());
|
||||
container.add(newValue);
|
||||
this.container.add(newValue);
|
||||
} else if (initialValue.getTime().longValue() < change.getTime().longValue()) {
|
||||
ITimeValue<T> newValue = new TimeValue<T>(change.getTime(), initialValue.getValue());
|
||||
newValue.add(change.getValue());
|
||||
container.add(newValue);
|
||||
this.container.add(newValue);
|
||||
}
|
||||
compact();
|
||||
}
|
||||
|
@ -86,10 +86,10 @@ public class TimeVariable<T extends IValue> implements ITimeVariable<T>, Seriali
|
|||
@Override
|
||||
public void compact() {
|
||||
|
||||
if (container.size() < 2)
|
||||
if (this.container.size() < 2)
|
||||
return;
|
||||
|
||||
Iterator<ITimeValue<T>> iterator = container.iterator();
|
||||
Iterator<ITimeValue<T>> iterator = this.container.iterator();
|
||||
ITimeValue<T> predecessor = iterator.next();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import li.strolch.model.timevalue.IValueChange;
|
|||
public class ValueChange<T extends IValue> implements IValueChange<T>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
protected final Long time;
|
||||
protected final T value;
|
||||
|
||||
|
@ -27,19 +27,19 @@ public class ValueChange<T extends IValue> implements IValueChange<T>, Serializa
|
|||
|
||||
@Override
|
||||
public Long getTime() {
|
||||
return time;
|
||||
return this.time;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getValue() {
|
||||
return (T) value.getCopy();
|
||||
return (T) this.value.getCopy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public IValueChange<T> getInverse() {
|
||||
return new ValueChange(time, value.getInverse());
|
||||
return new ValueChange(this.time, this.value.getInverse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,15 +51,15 @@ public class ValueChange<T extends IValue> implements IValueChange<T>, Serializa
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ValueChange<?> other = (ValueChange<?>) obj;
|
||||
if (time == null) {
|
||||
if (this.time == null) {
|
||||
if (other.time != null)
|
||||
return false;
|
||||
} else if (!time.equals(other.time))
|
||||
} else if (!this.time.equals(other.time))
|
||||
return false;
|
||||
if (value == null) {
|
||||
if (this.value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
} else if (!this.value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -68,14 +68,21 @@ public class ValueChange<T extends IValue> implements IValueChange<T>, Serializa
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((time == null) ? 0 : time.hashCode());
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
result = prime * result + ((this.time == null) ? 0 : this.time.hashCode());
|
||||
result = prime * result + ((this.value == null) ? 0 : this.value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValueChange [time=" + time + ", value=" + value + "]";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("ValueChange [time=");
|
||||
sb.append(this.time);
|
||||
sb.append(", value=");
|
||||
sb.append(this.value);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package li.strolch.model.timedstate;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import li.strolch.model.timevalue.ITimeValue;
|
||||
import li.strolch.model.timevalue.IValueChange;
|
||||
import li.strolch.model.timevalue.impl.DoubleValue;
|
||||
|
@ -25,69 +27,69 @@ public class TimeStateTest {
|
|||
@Before
|
||||
public void before() {
|
||||
|
||||
final IValueChange<DoubleValue> change1 = new ValueChange<DoubleValue>(t10, expectedValue1);
|
||||
state.applyChange(change1);
|
||||
final IValueChange<DoubleValue> change1 = new ValueChange<DoubleValue>(this.t10, this.expectedValue1);
|
||||
this.state.applyChange(change1);
|
||||
|
||||
final ITimeValue<DoubleValue> stateAt9 = state.getStateAt(9L);
|
||||
Assert.assertNull(stateAt9);
|
||||
final ITimeValue<DoubleValue> stateAt9 = this.state.getStateAt(9L);
|
||||
assertNull(stateAt9);
|
||||
|
||||
final ITimeValue<DoubleValue> stateAt11 = state.getStateAt(11L);
|
||||
Assert.assertNotNull(stateAt11);
|
||||
Assert.assertEquals(true, stateAt11.getValue().matches(expectedValue1));
|
||||
final ITimeValue<DoubleValue> stateAt11 = this.state.getStateAt(11L);
|
||||
assertNotNull(stateAt11);
|
||||
assertEquals(true, stateAt11.getValue().matches(this.expectedValue1));
|
||||
|
||||
final IValueChange<DoubleValue> change2 = new ValueChange<DoubleValue>(t30, expectedValue1);
|
||||
state.applyChange(change2);
|
||||
final IValueChange<DoubleValue> change2 = new ValueChange<DoubleValue>(this.t30, this.expectedValue1);
|
||||
this.state.applyChange(change2);
|
||||
|
||||
final ITimeValue<DoubleValue> stateAt31 = state.getStateAt(31L);
|
||||
Assert.assertNotNull(stateAt31);
|
||||
Assert.assertEquals(true, stateAt31.getValue().matches(expectedValue2));
|
||||
final ITimeValue<DoubleValue> stateAt31 = this.state.getStateAt(31L);
|
||||
assertNotNull(stateAt31);
|
||||
assertEquals(true, stateAt31.getValue().matches(this.expectedValue2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextMatch() {
|
||||
|
||||
ITimeValue<DoubleValue> nextMatch = state.getNextMatch(t0, expectedValue1);
|
||||
Assert.assertNotNull(nextMatch);
|
||||
Assert.assertEquals(t10, nextMatch.getTime());
|
||||
ITimeValue<DoubleValue> nextMatch = this.state.getNextMatch(this.t0, this.expectedValue1);
|
||||
assertNotNull(nextMatch);
|
||||
assertEquals(this.t10, nextMatch.getTime());
|
||||
|
||||
nextMatch = state.getNextMatch(t20, expectedValue1);
|
||||
Assert.assertNull(nextMatch);
|
||||
nextMatch = this.state.getNextMatch(this.t20, this.expectedValue1);
|
||||
assertNull(nextMatch);
|
||||
|
||||
nextMatch = state.getNextMatch(t20, expectedValue2);
|
||||
Assert.assertNotNull(nextMatch);
|
||||
Assert.assertEquals(t30, nextMatch.getTime());
|
||||
nextMatch = this.state.getNextMatch(this.t20, this.expectedValue2);
|
||||
assertNotNull(nextMatch);
|
||||
assertEquals(this.t30, nextMatch.getTime());
|
||||
|
||||
nextMatch = state.getNextMatch(t30, expectedValue2);
|
||||
Assert.assertNotNull(nextMatch);
|
||||
Assert.assertEquals(t30, nextMatch.getTime());
|
||||
nextMatch = this.state.getNextMatch(this.t30, this.expectedValue2);
|
||||
assertNotNull(nextMatch);
|
||||
assertEquals(this.t30, nextMatch.getTime());
|
||||
|
||||
nextMatch = state.getNextMatch(t100, expectedValue1);
|
||||
Assert.assertNull(nextMatch);
|
||||
nextMatch = this.state.getNextMatch(this.t100, this.expectedValue1);
|
||||
assertNull(nextMatch);
|
||||
|
||||
nextMatch = state.getNextMatch(t100, expectedValue2);
|
||||
Assert.assertNull(nextMatch);
|
||||
nextMatch = this.state.getNextMatch(this.t100, this.expectedValue2);
|
||||
assertNull(nextMatch);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPreviousMatch() {
|
||||
|
||||
ITimeValue<DoubleValue> previousMatch = state.getPreviousMatch(t100, expectedValue2);
|
||||
Assert.assertNotNull(previousMatch);
|
||||
Assert.assertEquals(t30, previousMatch.getTime());
|
||||
ITimeValue<DoubleValue> previousMatch = this.state.getPreviousMatch(this.t100, this.expectedValue2);
|
||||
assertNotNull(previousMatch);
|
||||
assertEquals(this.t30, previousMatch.getTime());
|
||||
|
||||
previousMatch = state.getPreviousMatch(t30, expectedValue2);
|
||||
Assert.assertNull(previousMatch);
|
||||
|
||||
previousMatch = state.getPreviousMatch(t20, expectedValue2);
|
||||
Assert.assertNull(previousMatch);
|
||||
|
||||
previousMatch = state.getPreviousMatch(t20, expectedValue1);
|
||||
Assert.assertNotNull(previousMatch);
|
||||
Assert.assertEquals(t10, previousMatch.getTime());
|
||||
|
||||
previousMatch = state.getPreviousMatch(t10, expectedValue1);
|
||||
Assert.assertNull(previousMatch);
|
||||
previousMatch = this.state.getPreviousMatch(this.t30, this.expectedValue2);
|
||||
assertNull(previousMatch);
|
||||
|
||||
previousMatch = this.state.getPreviousMatch(this.t20, this.expectedValue2);
|
||||
assertNull(previousMatch);
|
||||
|
||||
previousMatch = this.state.getPreviousMatch(this.t20, this.expectedValue1);
|
||||
assertNotNull(previousMatch);
|
||||
assertEquals(this.t10, previousMatch.getTime());
|
||||
|
||||
previousMatch = this.state.getPreviousMatch(this.t10, this.expectedValue1);
|
||||
assertNull(previousMatch);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package li.strolch.model.timevalue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import li.strolch.model.timevalue.impl.DoubleValue;
|
||||
import li.strolch.model.timevalue.impl.TimeVariable;
|
||||
import li.strolch.model.timevalue.impl.ValueChange;
|
||||
|
@ -24,16 +27,16 @@ public class FloatTimeVariableTest {
|
|||
*/
|
||||
@Before
|
||||
public void init() {
|
||||
timeVariable = new TimeVariable<DoubleValue>();
|
||||
this.timeVariable = new TimeVariable<DoubleValue>();
|
||||
for (long i = 0; i < MAX; i += STEP) {
|
||||
timeVariable.setValueAt(Long.valueOf(i), new DoubleValue(i));
|
||||
this.timeVariable.setValueAt(Long.valueOf(i), new DoubleValue(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValueAt() {
|
||||
ITimeValue<DoubleValue> valueAt = timeVariable.getValueAt(PICK);
|
||||
Assert.assertEquals(PICK.doubleValue(), valueAt.getValue().getValue());
|
||||
ITimeValue<DoubleValue> valueAt = this.timeVariable.getValueAt(PICK);
|
||||
assertEquals(PICK.doubleValue(), valueAt.getValue().getValue(), 0.0001);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,12 +44,12 @@ public class FloatTimeVariableTest {
|
|||
*/
|
||||
@Test
|
||||
public void testGetFutureValues() {
|
||||
Collection<ITimeValue<DoubleValue>> futureValues = timeVariable.getFutureValues(PICK);
|
||||
Collection<ITimeValue<DoubleValue>> futureValues = this.timeVariable.getFutureValues(PICK);
|
||||
Long expectedTime = PICK;
|
||||
Double expectedValue = PICK.doubleValue();
|
||||
for (ITimeValue<DoubleValue> value : futureValues) {
|
||||
Assert.assertEquals(expectedTime, value.getTime());
|
||||
Assert.assertTrue(value.getValue().matches(new DoubleValue(expectedValue)));
|
||||
assertEquals(expectedTime, value.getTime());
|
||||
assertTrue(value.getValue().matches(new DoubleValue(expectedValue)));
|
||||
expectedTime += STEP;
|
||||
expectedValue += STEP.doubleValue();
|
||||
}
|
||||
|
@ -58,12 +61,12 @@ public class FloatTimeVariableTest {
|
|||
*/
|
||||
@Test
|
||||
public void testGetPastValues() {
|
||||
Collection<ITimeValue<DoubleValue>> pastValues = timeVariable.getPastValues(MAX);
|
||||
Collection<ITimeValue<DoubleValue>> pastValues = this.timeVariable.getPastValues(MAX);
|
||||
Long expectedTime = 0L;
|
||||
Double expectedValue = expectedTime.doubleValue();
|
||||
for (ITimeValue<DoubleValue> value : pastValues) {
|
||||
Assert.assertEquals(expectedTime, value.getTime());
|
||||
Assert.assertTrue(value.getValue().matches(new DoubleValue(expectedValue)));
|
||||
assertEquals(expectedTime, value.getTime());
|
||||
assertTrue(value.getValue().matches(new DoubleValue(expectedValue)));
|
||||
expectedTime += STEP;
|
||||
expectedValue += STEP.doubleValue();
|
||||
}
|
||||
|
@ -78,16 +81,16 @@ public class FloatTimeVariableTest {
|
|||
DoubleValue doubleValue = new DoubleValue(STEP.doubleValue());
|
||||
|
||||
IValueChange<DoubleValue> change = new ValueChange<DoubleValue>(PICK, doubleValue);
|
||||
timeVariable.applyChange(change);
|
||||
this.timeVariable.applyChange(change);
|
||||
|
||||
Collection<ITimeValue<DoubleValue>> futureValues = timeVariable.getFutureValues(PICK);
|
||||
Collection<ITimeValue<DoubleValue>> futureValues = this.timeVariable.getFutureValues(PICK);
|
||||
Long expectedTime = PICK;
|
||||
|
||||
IValue<Double> expectedValue = new DoubleValue(PICK.doubleValue() + change.getValue().getValue());
|
||||
|
||||
for (ITimeValue<DoubleValue> value : futureValues) {
|
||||
Assert.assertEquals(expectedTime, value.getTime());
|
||||
Assert.assertTrue(expectedValue.matches(value.getValue()));
|
||||
assertEquals(expectedTime, value.getTime());
|
||||
assertTrue(expectedValue.matches(value.getValue()));
|
||||
expectedTime += STEP;
|
||||
expectedValue = expectedValue.add(STEP.doubleValue());
|
||||
}
|
||||
|
@ -99,18 +102,18 @@ public class FloatTimeVariableTest {
|
|||
@Test
|
||||
public void testApply2Change() {
|
||||
|
||||
timeVariable = new TimeVariable<DoubleValue>();
|
||||
this.timeVariable = new TimeVariable<DoubleValue>();
|
||||
|
||||
DoubleValue doubleValue = new DoubleValue(STEP.doubleValue());
|
||||
|
||||
IValueChange<DoubleValue> change = new ValueChange<DoubleValue>(PICK, doubleValue);
|
||||
timeVariable.applyChange(change);
|
||||
this.timeVariable.applyChange(change);
|
||||
|
||||
ITimeValue<DoubleValue> actual = timeVariable.getValueAt(PICK);
|
||||
Assert.assertNotNull(actual);
|
||||
ITimeValue<DoubleValue> actual = this.timeVariable.getValueAt(PICK);
|
||||
assertNotNull(actual);
|
||||
|
||||
IValue<Double> expectedValue = new DoubleValue(STEP.doubleValue());
|
||||
Assert.assertEquals(true, actual.getValue().matches(expectedValue));
|
||||
assertEquals(true, actual.getValue().matches(expectedValue));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,15 +123,15 @@ public class FloatTimeVariableTest {
|
|||
@Test
|
||||
public void testCompact() {
|
||||
|
||||
timeVariable = new TimeVariable<DoubleValue>();
|
||||
this.timeVariable = new TimeVariable<DoubleValue>();
|
||||
for (Long i = 0L; i < MAX; i += STEP) {
|
||||
timeVariable.setValueAt(i, new DoubleValue(STEP.doubleValue()));
|
||||
this.timeVariable.setValueAt(i, new DoubleValue(STEP.doubleValue()));
|
||||
}
|
||||
// call
|
||||
timeVariable.compact();
|
||||
this.timeVariable.compact();
|
||||
// check
|
||||
SortedSet<ITimeValue<DoubleValue>> futureValues = timeVariable.getFutureValues(0L);
|
||||
Assert.assertEquals(1, futureValues.size());
|
||||
SortedSet<ITimeValue<DoubleValue>> futureValues = this.timeVariable.getFutureValues(0L);
|
||||
assertEquals(1, futureValues.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package li.strolch.model.timevalue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import li.strolch.model.timevalue.impl.IntegerValue;
|
||||
import li.strolch.model.timevalue.impl.TimeVariable;
|
||||
import li.strolch.model.timevalue.impl.ValueChange;
|
||||
|
@ -32,19 +34,19 @@ public class IntegerTimeVariableTest {
|
|||
*/
|
||||
@Before
|
||||
public void init() {
|
||||
timeVariable = new TimeVariable<IntegerValue>();
|
||||
this.timeVariable = new TimeVariable<IntegerValue>();
|
||||
for (int i = 0; i < MAX; i += STEP) {
|
||||
IntegerValue expectedValue = new IntegerValue(i);
|
||||
Long time = Long.valueOf(i);
|
||||
expectedValues.put(time, expectedValue);
|
||||
timeVariable.setValueAt(time, expectedValue);
|
||||
this.expectedValues.put(time, expectedValue);
|
||||
this.timeVariable.setValueAt(time, expectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValueAt() {
|
||||
ITimeValue<IntegerValue> valueAt = timeVariable.getValueAt(PICK);
|
||||
Assert.assertEquals(expectedValues.get(PICK), valueAt.getValue());
|
||||
ITimeValue<IntegerValue> valueAt = this.timeVariable.getValueAt(PICK);
|
||||
assertEquals(this.expectedValues.get(PICK), valueAt.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,29 +54,28 @@ public class IntegerTimeVariableTest {
|
|||
*/
|
||||
@Test
|
||||
public void testGetFutureValues() {
|
||||
Collection<ITimeValue<IntegerValue>> futureValues = timeVariable.getFutureValues(PICK);
|
||||
Collection<ITimeValue<IntegerValue>> futureValues = this.timeVariable.getFutureValues(PICK);
|
||||
Long expectedTime = PICK;
|
||||
Integer expectedValue = PICK.intValue();
|
||||
for (ITimeValue<IntegerValue> value : futureValues) {
|
||||
Assert.assertEquals(expectedTime, value.getTime());
|
||||
Assert.assertTrue(value.getValue().matches(new IntegerValue(expectedValue)));
|
||||
assertEquals(expectedTime, value.getTime());
|
||||
assertTrue(value.getValue().matches(new IntegerValue(expectedValue)));
|
||||
expectedTime += STEP;
|
||||
expectedValue += STEP.intValue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test, that the past values time fields start with 0 and are strictly
|
||||
* smaller than PICK
|
||||
* test, that the past values time fields start with 0 and are strictly smaller than PICK
|
||||
*/
|
||||
@Test
|
||||
public void testGetPastValues() {
|
||||
Collection<ITimeValue<IntegerValue>> pastValues = timeVariable.getPastValues(MAX);
|
||||
Collection<ITimeValue<IntegerValue>> pastValues = this.timeVariable.getPastValues(MAX);
|
||||
Long expectedTime = 0L;
|
||||
Integer expectedValue = expectedTime.intValue();
|
||||
for (ITimeValue<IntegerValue> value : pastValues) {
|
||||
Assert.assertEquals(expectedTime, value.getTime());
|
||||
Assert.assertTrue(value.getValue().matches(new IntegerValue(expectedValue)));
|
||||
assertEquals(expectedTime, value.getTime());
|
||||
assertTrue(value.getValue().matches(new IntegerValue(expectedValue)));
|
||||
expectedTime += STEP;
|
||||
expectedValue += STEP.intValue();
|
||||
}
|
||||
|
@ -89,40 +90,39 @@ public class IntegerTimeVariableTest {
|
|||
IntegerValue integerValue = new IntegerValue(STEP.intValue());
|
||||
|
||||
IValueChange<IntegerValue> change = new ValueChange<IntegerValue>(PICK, integerValue);
|
||||
timeVariable.applyChange(change);
|
||||
this.timeVariable.applyChange(change);
|
||||
|
||||
Collection<ITimeValue<IntegerValue>> futureValues = timeVariable.getFutureValues(PICK);
|
||||
Collection<ITimeValue<IntegerValue>> futureValues = this.timeVariable.getFutureValues(PICK);
|
||||
Long expectedTime = PICK;
|
||||
|
||||
IValue<Integer> expectedValue = new IntegerValue(PICK.intValue() + change.getValue().getValue());
|
||||
for (ITimeValue<IntegerValue> value : futureValues) {
|
||||
Assert.assertEquals(expectedTime, value.getTime());
|
||||
Assert.assertTrue(expectedValue.matches(value.getValue()));
|
||||
assertEquals(expectedTime, value.getTime());
|
||||
assertTrue(expectedValue.matches(value.getValue()));
|
||||
expectedTime += STEP;
|
||||
expectedValue = expectedValue.add(STEP.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test that successors matching the values of their predecessors are
|
||||
* removed
|
||||
* test that successors matching the values of their predecessors are removed
|
||||
*/
|
||||
@Test
|
||||
public void testCompact() {
|
||||
timeVariable = new TimeVariable<IntegerValue>();
|
||||
this.timeVariable = new TimeVariable<IntegerValue>();
|
||||
for (Long i = 0L; i < MAX; i += STEP) {
|
||||
timeVariable.setValueAt(i, new IntegerValue(STEP.intValue()));
|
||||
this.timeVariable.setValueAt(i, new IntegerValue(STEP.intValue()));
|
||||
}
|
||||
|
||||
// call
|
||||
timeVariable.compact();
|
||||
this.timeVariable.compact();
|
||||
|
||||
// check
|
||||
SortedSet<ITimeValue<IntegerValue>> futureValues = timeVariable.getFutureValues(0L);
|
||||
Assert.assertEquals(1, futureValues.size());
|
||||
SortedSet<ITimeValue<IntegerValue>> futureValues = this.timeVariable.getFutureValues(0L);
|
||||
assertEquals(1, futureValues.size());
|
||||
|
||||
ITimeValue<IntegerValue> next = futureValues.iterator().next();
|
||||
Assert.assertEquals(Long.valueOf(0), next.getTime());
|
||||
assertEquals(Long.valueOf(0), next.getTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package li.strolch.model.timevalue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -7,7 +10,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import li.strolch.model.timevalue.impl.AString;
|
||||
import li.strolch.model.timevalue.impl.StringSetValue;
|
||||
import li.strolch.model.timevalue.impl.TimeVariable;
|
||||
|
@ -28,41 +30,41 @@ public class StringTimeVariableTest {
|
|||
|
||||
@Before
|
||||
public void init() {
|
||||
timeVariable = new TimeVariable<IValue<Set<AString>>>();
|
||||
this.timeVariable = new TimeVariable<IValue<Set<AString>>>();
|
||||
for (Long i = 0L; i < MAX; i += STEP) {
|
||||
Set<AString> testSet = new HashSet<AString>();
|
||||
StringSetValue testValue = new StringSetValue(testSet);
|
||||
testSets.put(i, testValue);
|
||||
testSet.add(new AString("string " + i));
|
||||
timeVariable.setValueAt(i, new StringSetValue(testSet));
|
||||
this.testSets.put(i, testValue);
|
||||
testSet.add(new AString("string " + i)); //$NON-NLS-1$
|
||||
this.timeVariable.setValueAt(i, new StringSetValue(testSet));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetValueAt() {
|
||||
ITimeValue<IValue<Set<AString>>> valueAt = timeVariable.getValueAt(PICK);
|
||||
Assert.assertEquals(true, valueAt.getValue().matches(testSets.get(PICK)));
|
||||
ITimeValue<IValue<Set<AString>>> valueAt = this.timeVariable.getValueAt(PICK);
|
||||
assertEquals(true, valueAt.getValue().matches(this.testSets.get(PICK)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFutureValues() {
|
||||
Collection<ITimeValue<IValue<Set<AString>>>> futureValues = timeVariable.getFutureValues(PICK);
|
||||
Collection<ITimeValue<IValue<Set<AString>>>> futureValues = this.timeVariable.getFutureValues(PICK);
|
||||
for (ITimeValue<IValue<Set<AString>>> iTimeValue : futureValues) {
|
||||
Long time = iTimeValue.getTime();
|
||||
Assert.assertEquals(true, time >= PICK);
|
||||
Assert.assertNotNull(iTimeValue.getValue());
|
||||
Assert.assertEquals(true, iTimeValue.getValue().matches(testSets.get(time)));
|
||||
assertEquals(true, time >= PICK);
|
||||
assertNotNull(iTimeValue.getValue());
|
||||
assertEquals(true, iTimeValue.getValue().matches(this.testSets.get(time)));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPastValues() {
|
||||
Collection<ITimeValue<IValue<Set<AString>>>> pastValues = timeVariable.getPastValues(PICK);
|
||||
Collection<ITimeValue<IValue<Set<AString>>>> pastValues = this.timeVariable.getPastValues(PICK);
|
||||
for (ITimeValue<IValue<Set<AString>>> iTimeValue : pastValues) {
|
||||
Long time = iTimeValue.getTime();
|
||||
Assert.assertEquals(true, time < PICK);
|
||||
Assert.assertNotNull(iTimeValue.getValue());
|
||||
Assert.assertEquals(true, iTimeValue.getValue().matches(testSets.get(time)));
|
||||
assertEquals(true, time < PICK);
|
||||
assertNotNull(iTimeValue.getValue());
|
||||
assertEquals(true, iTimeValue.getValue().matches(this.testSets.get(time)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,45 +72,45 @@ public class StringTimeVariableTest {
|
|||
public void testApplyChange() {
|
||||
|
||||
Set<AString> testSet = new HashSet<AString>();
|
||||
testSet.add(new AString("Martin"));
|
||||
testSet.add(new AString("Martin")); //$NON-NLS-1$
|
||||
StringSetValue testValue = new StringSetValue(testSet);
|
||||
|
||||
timeVariable = new TimeVariable<IValue<Set<AString>>>();
|
||||
timeVariable.setValueAt(PICK, testValue);
|
||||
this.timeVariable = new TimeVariable<IValue<Set<AString>>>();
|
||||
this.timeVariable.setValueAt(PICK, testValue);
|
||||
|
||||
IValue<Set<AString>> inverseTestValue = testValue.getInverse();
|
||||
IValueChange<IValue<Set<AString>>> change = new ValueChange<IValue<Set<AString>>>(PICK, inverseTestValue);
|
||||
timeVariable.applyChange(change);
|
||||
this.timeVariable.applyChange(change);
|
||||
|
||||
// check the future values
|
||||
Collection<ITimeValue<IValue<Set<AString>>>> futureValues = timeVariable.getFutureValues(0L);
|
||||
Collection<ITimeValue<IValue<Set<AString>>>> futureValues = this.timeVariable.getFutureValues(0L);
|
||||
for (ITimeValue<IValue<Set<AString>>> iTimeValue : futureValues) {
|
||||
System.out.println("++ " + iTimeValue);
|
||||
System.out.println("++ " + iTimeValue); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
Assert.assertEquals(1, futureValues.size()); // a empty one is left
|
||||
|
||||
assertEquals(1, futureValues.size()); // a empty one is left
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompact() {
|
||||
|
||||
timeVariable = new TimeVariable<IValue<Set<AString>>>();
|
||||
this.timeVariable = new TimeVariable<IValue<Set<AString>>>();
|
||||
for (Long i = 0L; i < MAX; i += STEP) {
|
||||
Set<AString> testSet = new HashSet<AString>();
|
||||
StringSetValue testValue = new StringSetValue(testSet);
|
||||
testSets.put(i, testValue);
|
||||
testSet.add(new AString("same string"));
|
||||
timeVariable.setValueAt(i, new StringSetValue(testSet));
|
||||
this.testSets.put(i, testValue);
|
||||
testSet.add(new AString("same string")); //$NON-NLS-1$
|
||||
this.timeVariable.setValueAt(i, new StringSetValue(testSet));
|
||||
}
|
||||
|
||||
SortedSet<ITimeValue<IValue<Set<AString>>>> valuesInitial = timeVariable.getFutureValues(0L);
|
||||
Assert.assertEquals(true, valuesInitial.size() > 1);
|
||||
SortedSet<ITimeValue<IValue<Set<AString>>>> valuesInitial = this.timeVariable.getFutureValues(0L);
|
||||
assertEquals(true, valuesInitial.size() > 1);
|
||||
|
||||
timeVariable.compact();
|
||||
this.timeVariable.compact();
|
||||
|
||||
SortedSet<ITimeValue<IValue<Set<AString>>>> valuesCompacted = timeVariable.getFutureValues(0L);
|
||||
Assert.assertEquals(1, valuesCompacted.size());
|
||||
SortedSet<ITimeValue<IValue<Set<AString>>>> valuesCompacted = this.timeVariable.getFutureValues(0L);
|
||||
assertEquals(1, valuesCompacted.size());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,9 @@ public class ValueTests {
|
|||
DoubleValue value = new DoubleValue(10.0d);
|
||||
DoubleValue inverse = value.getInverse();
|
||||
assertEquals(Double.valueOf(-10.0d), inverse.getValue());
|
||||
assertEquals(Double.valueOf(0), value.add(inverse.getValue())
|
||||
.getValue());
|
||||
assertEquals(Double.valueOf(0), value.add(inverse.getValue()).getValue());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check, that adding the inverse results in the neutral element (=0)
|
||||
*/
|
||||
|
@ -34,8 +33,7 @@ public class ValueTests {
|
|||
IntegerValue value = new IntegerValue(10);
|
||||
IntegerValue inverse = value.getInverse();
|
||||
assertEquals(Integer.valueOf(-10), inverse.getValue());
|
||||
assertEquals(Integer.valueOf(0), value.add(inverse.getValue())
|
||||
.getValue());
|
||||
assertEquals(Integer.valueOf(0), value.add(inverse.getValue()).getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +43,7 @@ public class ValueTests {
|
|||
public void testStringSetInverse() {
|
||||
Set<AString> aStrings = new HashSet<AString>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
aStrings.add(new AString("string " + i));
|
||||
aStrings.add(new AString("string " + i)); //$NON-NLS-1$
|
||||
}
|
||||
IValue<Set<AString>> value = new StringSetValue(aStrings);
|
||||
IValue<Set<AString>> inverse = value.getInverse();
|
||||
|
@ -61,20 +59,19 @@ public class ValueTests {
|
|||
|
||||
Set<AString> aStrings1 = new HashSet<AString>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
aStrings1.add(new AString("string " + i));
|
||||
aStrings1.add(new AString("string " + i)); //$NON-NLS-1$
|
||||
}
|
||||
IValue<Set<AString>> value1 = new StringSetValue(aStrings1);
|
||||
|
||||
Set<AString> aStrings2 = new HashSet<AString>();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
aStrings2.add(new AString("string " + i, true));
|
||||
aStrings2.add(new AString("string " + i, true)); //$NON-NLS-1$
|
||||
}
|
||||
IValue<Set<AString>> value2 = new StringSetValue(aStrings2);
|
||||
|
||||
assertEquals(false, value1.matches(value2));
|
||||
assertEquals(1, value1.add(value2.getValue()).getValue().size());
|
||||
assertEquals(10, value1.add(value2.getInverse().getValue()).getValue()
|
||||
.size());
|
||||
assertEquals(10, value1.add(value2.getInverse().getValue()).getValue().size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package li.strolch.test.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import li.strolch.model.Order;
|
||||
import li.strolch.model.ParameterBag;
|
||||
import li.strolch.model.Resource;
|
||||
|
@ -17,6 +19,7 @@ import li.strolch.model.parameter.StringParameter;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public class ModelTest {
|
||||
|
||||
@Test
|
||||
|
@ -38,11 +41,11 @@ public class ModelTest {
|
|||
|
||||
public static void validateBag(ParameterBag bag) {
|
||||
|
||||
Assert.assertNotNull(bag);
|
||||
assertNotNull(bag);
|
||||
|
||||
Assert.assertEquals(ModelTestHelper.BAG_ID, bag.getId());
|
||||
Assert.assertEquals(ModelTestHelper.BAG_NAME, bag.getName());
|
||||
Assert.assertEquals(ModelTestHelper.BAG_TYPE, bag.getType());
|
||||
assertEquals(ModelTestHelper.BAG_ID, bag.getId());
|
||||
assertEquals(ModelTestHelper.BAG_NAME, bag.getName());
|
||||
assertEquals(ModelTestHelper.BAG_TYPE, bag.getType());
|
||||
|
||||
validateParams(bag);
|
||||
}
|
||||
|
@ -50,35 +53,35 @@ public class ModelTest {
|
|||
public static void validateParams(ParameterBag bag) {
|
||||
|
||||
BooleanParameter boolParam = bag.getParameter(ModelTestHelper.PARAM_BOOLEAN_ID);
|
||||
Assert.assertNotNull("Boolean Param missing with id " + ModelTestHelper.PARAM_BOOLEAN_ID, boolParam);
|
||||
Assert.assertEquals(true, boolParam.getValue().booleanValue());
|
||||
assertNotNull("Boolean Param missing with id " + ModelTestHelper.PARAM_BOOLEAN_ID, boolParam);
|
||||
assertEquals(true, boolParam.getValue().booleanValue());
|
||||
|
||||
FloatParameter floatParam = bag.getParameter(ModelTestHelper.PARAM_FLOAT_ID);
|
||||
Assert.assertNotNull("Float Param missing with id " + ModelTestHelper.PARAM_FLOAT_ID, floatParam);
|
||||
Assert.assertEquals(44.3, floatParam.getValue().doubleValue());
|
||||
assertNotNull("Float Param missing with id " + ModelTestHelper.PARAM_FLOAT_ID, floatParam);
|
||||
assertEquals(44.3, floatParam.getValue().doubleValue(), 0.0001);
|
||||
|
||||
IntegerParameter integerParam = bag.getParameter(ModelTestHelper.PARAM_INTEGER_ID);
|
||||
Assert.assertNotNull("Integer Param missing with id " + ModelTestHelper.PARAM_INTEGER_ID, integerParam);
|
||||
Assert.assertEquals(77, integerParam.getValue().intValue());
|
||||
assertNotNull("Integer Param missing with id " + ModelTestHelper.PARAM_INTEGER_ID, integerParam);
|
||||
assertEquals(77, integerParam.getValue().intValue());
|
||||
|
||||
LongParameter longParam = bag.getParameter(ModelTestHelper.PARAM_LONG_ID);
|
||||
Assert.assertNotNull("Long Param missing with id " + ModelTestHelper.PARAM_LONG_ID, longParam);
|
||||
Assert.assertEquals(4453234566L, longParam.getValue().longValue());
|
||||
assertNotNull("Long Param missing with id " + ModelTestHelper.PARAM_LONG_ID, longParam);
|
||||
assertEquals(4453234566L, longParam.getValue().longValue());
|
||||
|
||||
StringParameter stringParam = bag.getParameter(ModelTestHelper.PARAM_STRING_ID);
|
||||
Assert.assertNotNull("String Param missing with id " + ModelTestHelper.PARAM_STRING_ID, stringParam);
|
||||
Assert.assertEquals("Strolch", stringParam.getValue());
|
||||
assertNotNull("String Param missing with id " + ModelTestHelper.PARAM_STRING_ID, stringParam);
|
||||
assertEquals("Strolch", stringParam.getValue());
|
||||
|
||||
DateParameter dateParam = bag.getParameter(ModelTestHelper.PARAM_DATE_ID);
|
||||
Assert.assertNotNull("Date Param missing with id " + ModelTestHelper.PARAM_DATE_ID, dateParam);
|
||||
Assert.assertEquals(1354295525628L, dateParam.getValue().longValue());
|
||||
assertNotNull("Date Param missing with id " + ModelTestHelper.PARAM_DATE_ID, dateParam);
|
||||
assertEquals(1354295525628L, dateParam.getValue().longValue());
|
||||
|
||||
StringListParameter stringListP = bag.getParameter(ModelTestHelper.PARAM_LIST_STRING_ID);
|
||||
Assert.assertNotNull("StringList Param missing with id " + ModelTestHelper.PARAM_LIST_STRING_ID, stringListP);
|
||||
assertNotNull("StringList Param missing with id " + ModelTestHelper.PARAM_LIST_STRING_ID, stringListP);
|
||||
|
||||
ArrayList<String> stringList = new ArrayList<String>();
|
||||
stringList.add("Hello");
|
||||
stringList.add("World");
|
||||
Assert.assertEquals(stringList, stringListP.getValue());
|
||||
assertEquals(stringList, stringListP.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import li.strolch.model.parameter.StringParameter;
|
|||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("nls")
|
||||
public class ModelTestHelper {
|
||||
|
||||
public static final String PARAM_BOOLEAN_ID = "@param1";
|
||||
|
|
Loading…
Reference in New Issue