[Minor] NetBeans didn't play nice... now using tabs, instead of spaces

This commit is contained in:
Robert von Burg 2014-03-24 15:35:13 +01:00
parent 396d458112
commit 95117bdf88
69 changed files with 1770 additions and 1745 deletions

View File

@ -45,10 +45,8 @@ public abstract class AbstractStrolchElement implements StrolchElement {
/**
* Default constructor
*
* @param id
* id of this {@link StrolchElement}
* @param name
* name of this {@link StrolchElement}
* @param id id of this {@link StrolchElement}
* @param name name of this {@link StrolchElement}
*/
public AbstractStrolchElement(String id, String name) {
setId(id);
@ -99,8 +97,8 @@ public abstract class AbstractStrolchElement implements StrolchElement {
* 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
*
* @param locatorBuilder
* the {@link LocatorBuilder} to which the {@link StrolchElement} must add its locator information
* @param locatorBuilder the {@link LocatorBuilder} to which the {@link StrolchElement} must add its locator
* information
*/
protected abstract void fillLocator(LocatorBuilder locatorBuilder);
@ -149,18 +147,23 @@ public abstract class AbstractStrolchElement implements StrolchElement {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
AbstractStrolchElement other = (AbstractStrolchElement) obj;
if (this.id == null) {
if (other.id != null)
if (other.id != null) {
return false;
} else if (!this.id.equals(other.id))
}
} else if (!this.id.equals(other.id)) {
return false;
}
return true;
}

View File

@ -67,8 +67,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Sets the type of this {@link GroupedParameterizedElement}
*
* @param type
* the type to set
* @param type the type to set
*/
public void setType(String type) {
if (StringHelper.isEmpty(type)) {
@ -84,19 +83,19 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the given bagKey, or null if
* the {@link Parameter} or the {@link ParameterBag} does not exist
*
* @param bagKey
* the key of the {@link ParameterBag} from which the {@link Parameter} is to be returned
* @param paramKey
* the key of the {@link Parameter} which is to be returned
* @param bagKey the key of the {@link ParameterBag} from which the {@link Parameter} is to be returned
* @param paramKey the key of the {@link Parameter} which is to be returned
*
* @return the found {@link Parameter} or null if it was not found
*/
public <T> T getParameter(String bagKey, String paramKey) {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
return null;
}
ParameterBag bag = this.parameterBagMap.get(bagKey);
if (bag == null)
if (bag == null) {
return null;
}
return bag.getParameter(paramKey);
}
@ -104,17 +103,15 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Adds a new {@link Parameter} to the {@link ParameterBag} with the given key
*
* @param bagKey
* the key of the {@link ParameterBag} to which the {@link Parameter} should be added
* @param parameter
* the {@link Parameter} to be added to the {@link ParameterBag}
* @param bagKey the key of the {@link ParameterBag} to which the {@link Parameter} should be added
* @param parameter the {@link Parameter} to be added to the {@link ParameterBag}
*
* @throws StrolchException
* if the {@link ParameterBag} does not exist
* @throws StrolchException if the {@link ParameterBag} does not exist
*/
public void addParameter(String bagKey, Parameter<?> parameter) throws StrolchException {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
this.parameterBagMap = new HashMap<String, ParameterBag>();
}
ParameterBag bag = this.parameterBagMap.get(bagKey);
if (bag == null) {
String msg = "No parameter bag exists with key {0}"; //$NON-NLS-1$
@ -128,19 +125,19 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Removes the {@link Parameter} with the given paramKey from the {@link ParameterBag} with the given bagKey
*
* @param bagKey
* the key of the {@link ParameterBag} from which the {@link Parameter} is to be removed
* @param paramKey
* the key of the {@link Parameter} which is to be removed
* @param bagKey the key of the {@link ParameterBag} from which the {@link Parameter} is to be removed
* @param paramKey the key of the {@link Parameter} which is to be removed
*
* @return the removed {@link Parameter} or null if it did not exist
*/
public <T> Parameter<T> removeParameter(String bagKey, String paramKey) {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
return null;
}
ParameterBag bag = this.parameterBagMap.get(bagKey);
if (bag == null)
if (bag == null) {
return null;
}
return bag.removeParameter(paramKey);
}
@ -148,26 +145,26 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns the {@link ParameterBag} with the given key, or null if it does not exist
*
* @param key
* the key of the {@link ParameterBag} to return
* @param key the key of the {@link ParameterBag} to return
*
* @return the {@link ParameterBag} with the given key, or null if it does not exist
*/
public ParameterBag getParameterBag(String key) {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
return null;
}
return this.parameterBagMap.get(key);
}
/**
* Adds the given {@link ParameterBag} to this {@link GroupedParameterizedElement}
*
* @param bag
* the {@link ParameterBag} to add
* @param bag the {@link ParameterBag} to add
*/
public void addParameterBag(ParameterBag bag) {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
this.parameterBagMap = new HashMap<String, ParameterBag>();
}
this.parameterBagMap.put(bag.getId(), bag);
bag.setParent(this);
}
@ -175,14 +172,14 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Removes the {@link ParameterBag} with the given key
*
* @param key
* the key of the {@link ParameterBag} to remove
* @param key the key of the {@link ParameterBag} to remove
*
* @return the removed {@link ParameterBag}, or null if it does not exist
*/
public ParameterBag removeParameterBag(String key) {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
return null;
}
return this.parameterBagMap.remove(key);
}
@ -198,8 +195,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns true if the {@link ParameterBag} with the given key exists on this {@link GroupedParameterizedElement}.
*
* @param bagKey
* the key of the {@link ParameterBag} which is to be checked for existence
* @param bagKey the key of the {@link ParameterBag} which is to be checked for existence
* @return true if the {@link ParameterBag} with the given key exists on this {@link GroupedParameterizedElement}.
*/
public boolean hasParameterBag(String bagKey) {
@ -210,21 +206,21 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
* Returns true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the given
* bagKey
*
* @param bagKey
* the key of the {@link ParameterBag} on which to find the {@link Parameter}
* @param paramKey
* the key of the {@link Parameter} to be found
* @param bagKey the key of the {@link ParameterBag} on which to find the {@link Parameter}
* @param paramKey the key of the {@link Parameter} to be found
*
* @return true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the given
* bagKey. False is returned if the {@link ParameterBag} does not exist, or the {@link Parameter} does not
* exist on the {@link ParameterBag}
* bagKey. False is returned if the {@link ParameterBag} does not exist, or the {@link Parameter} does not exist on
* the {@link ParameterBag}
*/
public boolean hasParameter(String bagKey, String paramKey) {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
return false;
}
ParameterBag bag = this.parameterBagMap.get(bagKey);
if (bag == null)
if (bag == null) {
return false;
}
return bag.hasParameter(paramKey);
}
@ -235,8 +231,9 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
* @return the {@link Set} of keys for the {@link ParameterBag}s on this {@link GroupedParameterizedElement}
*/
public Set<String> getParameterBagKeySet() {
if (this.parameterBagMap == null)
if (this.parameterBagMap == null) {
return Collections.emptySet();
}
return new HashSet<String>(this.parameterBagMap.keySet());
}

View File

@ -57,26 +57,23 @@ public class Locator {
/**
* Constructs a new {@link Locator} with the given list of path elements
*
* @param pathElements
* the elements making up the {@link Locator}
* @param pathElements the elements making up the {@link Locator}
*
* @throws StrolchException
* if the path is invalid, meaning has less than two elements in it
* @throws StrolchException if the path is invalid, meaning has less than two elements in it
*/
public Locator(List<String> pathElements) throws StrolchException {
if (pathElements == null || pathElements.isEmpty())
if (pathElements == null || pathElements.isEmpty()) {
throw new StrolchException("The path elements may not be null and must contain at least 1 item"); //$NON-NLS-1$
}
this.pathElements = Collections.unmodifiableList(new ArrayList<String>(pathElements));
}
/**
* Constructs a new {@link Locator} by parsing the given string path.
*
* @param path
* the path to parse for instantiate this {@link Locator} with elements
* @param path the path to parse for instantiate this {@link Locator} with elements
*
* @throws StrolchException
* if the path is invalid, meaning has less than two elements in it
* @throws StrolchException if the path is invalid, meaning has less than two elements in it
*/
public Locator(String path) throws StrolchException {
this.pathElements = Collections.unmodifiableList(parsePath(path));
@ -85,10 +82,8 @@ public class Locator {
/**
* Internal constructor to append a sub path to a constructor
*
* @param path
* the base path of the locator
* @param subPath
* the additional path
* @param path the base path of the locator
* @param subPath the additional path
*/
private Locator(List<String> path, List<String> subPath) {
List<String> fullPath = new ArrayList<String>();
@ -100,10 +95,8 @@ public class Locator {
/**
* Internal constructor to append a element to a constructor
*
* @param path
* the base path of the locator
* @param element
* the additional element
* @param path the base path of the locator
* @param element the additional element
*/
private Locator(List<String> path, String element) {
List<String> fullPath = new ArrayList<String>();
@ -133,8 +126,7 @@ public class Locator {
/**
* Returns a new {@link Locator} where the given sub path is appended to the locator
*
* @param subPathElements
* the sub path to append
* @param subPathElements the sub path to append
*
* @return the new locator
*/
@ -145,8 +137,7 @@ public class Locator {
/**
* Returns a new {@link Locator} where the given element is appended to the locator
*
* @param element
* the element to append
* @param element the element to append
*
* @return the new locator
*/
@ -166,18 +157,17 @@ public class Locator {
/**
* Parses the given path to a {@link List} of path elements by splitting the string with the {@link #PATH_SEPARATOR}
*
* @param path
* the path to parse
* @param path the path to parse
*
* @return the list of path elements for the list
*
* @throws StrolchException
* if the path is empty, or does not contain at least 2 elements separated by {@link #PATH_SEPARATOR}
* @throws StrolchException if the path is empty, or does not contain at least 2 elements separated by
* {@link #PATH_SEPARATOR}
*/
private List<String> parsePath(String path) throws StrolchException {
if (StringHelper.isEmpty(path))
if (StringHelper.isEmpty(path)) {
throw new StrolchException("A path may not be empty!"); //$NON-NLS-1$
}
String[] elements = path.split(Locator.PATH_SEPARATOR);
return Arrays.asList(elements);
}
@ -185,13 +175,11 @@ public class Locator {
/**
* Formats the given list of path elements to a String representation of the {@link Locator}
*
* @param pathElements
* the locator elements
* @param pathElements the locator elements
*
* @return a string representation of the path elements
*
* @throws StrolchException
* if the path elements does not contain at least two items
* @throws StrolchException if the path elements does not contain at least two items
*/
private String formatPath(List<String> pathElements) throws StrolchException {
StringBuilder sb = new StringBuilder();
@ -200,9 +188,10 @@ public class Locator {
while (iter.hasNext()) {
String element = iter.next();
sb.append(element);
if (iter.hasNext())
if (iter.hasNext()) {
sb.append(Locator.PATH_SEPARATOR);
}
}
return sb.toString();
}
@ -217,26 +206,30 @@ public class Locator {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
Locator other = (Locator) obj;
if (this.pathElements == null) {
if (other.pathElements != null)
if (other.pathElements != null) {
return false;
} else if (!this.pathElements.equals(other.pathElements))
}
} else if (!this.pathElements.equals(other.pathElements)) {
return false;
}
return true;
}
/**
* Instantiates a new immutable {@link Locator} instance from the given string
*
* @param locatorPath
* the path from which to instantiate the locator
* @param locatorPath the path from which to instantiate the locator
* @return the immutable {@link Locator} instance
*/
public static Locator valueOf(String locatorPath) {
@ -246,8 +239,7 @@ public class Locator {
/**
* Creates a new {@link LocatorBuilder} instance and appends the given root element tag to it
*
* @param rootElement
* the first element on the {@link Locator}
* @param rootElement the first element on the {@link Locator}
*
* @return a new {@link LocatorBuilder} instance with the given root element tag as the first element
*/
@ -275,8 +267,7 @@ public class Locator {
/**
* Append an element to the path
*
* @param element
* the element to add
* @param element the element to add
*
* @return this instance for chaining
*/
@ -301,8 +292,9 @@ public class Locator {
* @return a new {@link Locator} instance
*/
public Locator build() {
if (this.pathElements.isEmpty())
if (this.pathElements.isEmpty()) {
throw new StrolchException("The path elements must contain at least 1 item"); //$NON-NLS-1$
}
return new Locator(this.pathElements);
}
}

View File

@ -112,8 +112,7 @@ public class Order extends GroupedParameterizedElement implements StrolchRootEle
}
/**
* @param date
* the date to set
* @param date the date to set
*/
public void setDate(Date date) {
this.date = date;
@ -127,8 +126,7 @@ public class Order extends GroupedParameterizedElement implements StrolchRootEle
}
/**
* @param state
* the state to set
* @param state the state to set
*/
public void setState(State state) {
this.state = state;

View File

@ -22,6 +22,7 @@ import org.w3c.dom.Element;
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class ParameterBag extends ParameterizedElement {
private static final long serialVersionUID = 1L;
/**

View File

@ -20,7 +20,7 @@ import li.strolch.model.visitor.StrolchElementVisitor;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public interface ResourceVisitor extends StrolchElementVisitor<Resource>{
public interface ResourceVisitor extends StrolchElementVisitor<Resource> {
@Override
public void visit(Resource element);

View File

@ -79,8 +79,7 @@ public interface StrolchElement extends Serializable, Comparable<StrolchElement>
/**
* 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 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

View File

@ -134,14 +134,18 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
element.setAttribute(Tags.VALUE, getValueAsString());
if (!this.interpretation.equals(Parameter.INTERPRETATION_NONE))
if (!this.interpretation.equals(Parameter.INTERPRETATION_NONE)) {
element.setAttribute(Tags.INTERPRETATION, this.interpretation);
if (!this.uom.equals(Parameter.UOM_NONE))
}
if (!this.uom.equals(Parameter.UOM_NONE)) {
element.setAttribute(Tags.UOM, this.uom);
if (this.hidden)
}
if (this.hidden) {
element.setAttribute(Tags.HIDDEN, Boolean.toString(this.hidden));
if (this.index != 0)
}
if (this.index != 0) {
element.setAttribute(Tags.INDEX, Integer.toString(this.index));
}
return element;
}
@ -207,11 +211,9 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
/**
* Validates that the value is legal. This is the case when it is not null in this implementation
*
* @param value
* the value to check for this parameter instance
* @param value the value to check for this parameter instance
*
* @throws StrolchException
* if the value is null
* @throws StrolchException if the value is null
*/
protected void validateValue(T value) throws StrolchException {
if (value == null) {

View File

@ -28,16 +28,14 @@ public interface ListParameter<E> extends Parameter<List<E>> {
/**
* 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);
/**
* 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
*/

View File

@ -108,8 +108,7 @@ public interface Parameter<T> extends StrolchElement {
/**
* Set the index of this {@link Parameter}. This can be used to sort the parameters in a UI
*
* @param index
* the index to set
* @param index the index to set
*/
public void setIndex(int index);

View File

@ -79,8 +79,9 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
@Override
public String getValueAsString() {
if (this.value.isEmpty())
if (this.value.isEmpty()) {
return StringHelper.EMPTY;
}
StringBuilder sb = new StringBuilder();
Iterator<String> iter = this.value.iterator();
@ -88,9 +89,10 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
sb.append(iter.next());
if (iter.hasNext())
if (iter.hasNext()) {
sb.append(VALUE_SEPARATOR);
}
}
return sb.toString();
}
@ -103,8 +105,9 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
@Override
public void setValue(List<String> value) {
validateValue(value);
if (this.value == null)
if (this.value == null) {
this.value = new ArrayList<String>(value.size());
}
this.value.clear();
this.value.addAll(value);
}
@ -141,8 +144,9 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
}
public static List<String> parseFromString(String value) {
if (value.isEmpty())
if (value.isEmpty()) {
return Collections.emptyList();
}
String[] valueArr = value.split(VALUE_SEPARATOR);
return Arrays.asList(valueArr);

View File

@ -15,7 +15,6 @@
*/
package li.strolch.model.query;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
@ -23,6 +22,5 @@ package li.strolch.model.query;
public interface Navigation {
// marker interface
public void accept(QueryVisitor visitor);
}

View File

@ -28,8 +28,7 @@ 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
public NotSelection with(Selection selection) {

View File

@ -139,6 +139,7 @@ public abstract class ParameterSelection implements Selection {
}
public static class BooleanParameterSelection extends ParameterSelection {
private Boolean value;
public BooleanParameterSelection(String bagKey, String paramKey, Boolean value) {
@ -157,6 +158,7 @@ public abstract class ParameterSelection implements Selection {
}
public static class LongParameterSelection extends ParameterSelection {
private Long value;
public LongParameterSelection(String bagKey, String paramKey, Long value) {
@ -175,6 +177,7 @@ public abstract class ParameterSelection implements Selection {
}
public static class FloatParameterSelection extends ParameterSelection {
private Double value;
public FloatParameterSelection(String bagKey, String paramKey, Double value) {
@ -193,6 +196,7 @@ public abstract class ParameterSelection implements Selection {
}
public static class DateParameterSelection extends ParameterSelection {
private Date value;
public DateParameterSelection(String bagKey, String paramKey, Date value) {
@ -211,6 +215,7 @@ public abstract class ParameterSelection implements Selection {
}
public static class StringListParameterSelection extends ParameterSelection {
private List<String> value;
public StringListParameterSelection(String bagKey, String paramKey, List<String> value) {

View File

@ -15,7 +15,6 @@
*/
package li.strolch.model.query;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*

View File

@ -21,6 +21,5 @@ package li.strolch.model.query;
public interface Selection {
// marker interface
public void accept(QueryVisitor visitor);
}

View File

@ -25,8 +25,7 @@ import li.strolch.model.timevalue.IValueChange;
*
* @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")
public interface ITimedState<T extends IValue> {
@ -42,8 +41,7 @@ public interface ITimedState<T extends IValue> {
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);

View File

@ -22,8 +22,7 @@ import li.strolch.model.timevalue.impl.TimeVariable;
*
* @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")
public interface ITimeValue<T extends IValue> extends Comparable<ITimeValue<T>> {

View File

@ -23,8 +23,7 @@ import java.util.SortedSet;
*
* @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")
public interface ITimeVariable<T extends IValue> {
@ -32,10 +31,8 @@ public interface ITimeVariable<T extends IValue> {
/**
* set the value at a point in time to a given time value object
*
* @param time
* the time to set the {@link IValue}
* @param value
* the {@link IValue} to set
* @param time the time to set the {@link IValue}
* @param value the {@link IValue} to set
*/
void setValueAt(final Long time, final T value);
@ -47,16 +44,14 @@ public interface ITimeVariable<T extends IValue> {
/**
* 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);
/**
* 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
*/
Collection<ITimeValue<T>> getFutureValues(final Long time);
@ -64,8 +59,7 @@ public interface ITimeVariable<T extends IValue> {
/**
* 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
*/
Collection<ITimeValue<T>> getPastValues(final Long time);

View File

@ -16,13 +16,12 @@
package li.strolch.model.timevalue;
/**
* A value object defining some basic algebraic operations. Mathematically
* speaking {@link IValue} objects define a group with a addition operation.
* A value object defining some basic algebraic operations. Mathematically speaking {@link IValue} objects define a
* group with a addition operation.
*
* @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> {
@ -42,8 +41,7 @@ public interface IValue<T> {
boolean matches(IValue<T> other);
/**
* @return the inverse value, such that add(value.getInverse()) returns the
* neutral element of the group
* @return the inverse value, such that add(value.getInverse()) returns the neutral element of the group
*/
IValue<T> getInverse();

View File

@ -16,8 +16,7 @@
package li.strolch.model.timevalue;
/**
* Interface for operators to be used to change the values of {@link ITimeValue}
* in a {@link ITimeVariable}.
* Interface for operators to be used to change the values of {@link ITimeValue} in a {@link ITimeVariable}.
*
* @author Martin Smock <smock.martin@gmail.com>
*/
@ -35,8 +34,7 @@ public interface IValueChange<T extends IValue> {
T getValue();
/**
* @return the inverse neutralizing a change. Very useful to undo changes
* applied.
* @return the inverse neutralizing a change. Very useful to undo changes applied.
*/
IValueChange<T> getInverse();

View File

@ -18,8 +18,7 @@ package li.strolch.model.timevalue.impl;
import java.io.Serializable;
/**
* Wrapper for java.util.String object defining a inverse to support algebraic
* operations.
* Wrapper for java.util.String object defining a inverse to support algebraic operations.
*
* @author Martin Smock <smock.martin@gmail.com>
*/
@ -63,20 +62,26 @@ public class AString implements Serializable {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
AString other = (AString) obj;
if (this.inverse != other.inverse)
if (this.inverse != other.inverse) {
return false;
}
if (this.string == null) {
if (other.string != null)
if (other.string != null) {
return false;
} else if (!this.string.equals(other.string))
}
} else if (!this.string.equals(other.string)) {
return false;
}
return true;
}

View File

@ -91,18 +91,23 @@ public class BooleanValue implements IValue<Boolean>, Serializable {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
BooleanValue other = (BooleanValue) obj;
if (this.value == null) {
if (other.value != null)
if (other.value != null) {
return false;
} else if (!this.value.equals(other.value))
}
} else if (!this.value.equals(other.value)) {
return false;
}
return true;
}
}

View File

@ -85,7 +85,7 @@ public class FloatValue implements IValue<Double>, Serializable {
}
@Override
public FloatValue getCopy(){
public FloatValue getCopy() {
return new FloatValue(this.value);
}
@ -99,20 +99,24 @@ public class FloatValue implements IValue<Double>, Serializable {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
FloatValue other = (FloatValue) obj;
if (this.value == null) {
if (other.value != null)
if (other.value != null) {
return false;
} else if (!this.value.equals(other.value))
}
} else if (!this.value.equals(other.value)) {
return false;
}
return true;
}
}

View File

@ -91,18 +91,23 @@ public class IntegerValue implements IValue<Integer>, Serializable {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
IntegerValue other = (IntegerValue) obj;
if (this.value == null) {
if (other.value != null)
if (other.value != null) {
return false;
} else if (!this.value.equals(other.value))
}
} else if (!this.value.equals(other.value)) {
return false;
}
return true;
}

View File

@ -98,24 +98,31 @@ public class TimeValue<T extends IValue> implements ITimeValue<T>, Serializable
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
@SuppressWarnings("unchecked")
TimeValue<T> other = (TimeValue<T>) obj;
if (this.time == null) {
if (other.time != null)
if (other.time != null) {
return false;
} else if (!this.time.equals(other.time))
}
} else if (!this.time.equals(other.time)) {
return false;
}
if (this.value == null) {
if (other.value != null)
if (other.value != null) {
return false;
} else if (!this.value.equals(other.value))
}
} else if (!this.value.equals(other.value)) {
return false;
}
return true;
}
}

View File

@ -101,8 +101,9 @@ public class TimeVariable<T extends IValue> implements ITimeVariable<T>, Seriali
@Override
public void compact() {
if (this.container.size() < 2)
if (this.container.size() < 2) {
return;
}
Iterator<ITimeValue<T>> iterator = this.container.iterator();
ITimeValue<T> predecessor = iterator.next();

View File

@ -59,23 +59,30 @@ public class ValueChange<T extends IValue> implements IValueChange<T>, Serializa
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
ValueChange<?> other = (ValueChange<?>) obj;
if (this.time == null) {
if (other.time != null)
if (other.time != null) {
return false;
} else if (!this.time.equals(other.time))
}
} else if (!this.time.equals(other.time)) {
return false;
}
if (this.value == null) {
if (other.value != null)
if (other.value != null) {
return false;
} else if (!this.value.equals(other.value))
}
} else if (!this.value.equals(other.value)) {
return false;
}
return true;
}

View File

@ -55,14 +55,16 @@ public abstract class AbstractToSaxWriterVisitor {
protected void writeStartStrolchElement(String tag, boolean empty, StrolchElement element)
throws XMLStreamException {
if (empty)
if (empty) {
this.writer.writeEmptyElement(tag);
else
} else {
this.writer.writeStartElement(tag);
}
this.writer.writeAttribute(Tags.ID, element.getId());
if (StringHelper.isNotEmpty(element.getName()))
if (StringHelper.isNotEmpty(element.getName())) {
this.writer.writeAttribute(Tags.NAME, element.getName());
}
this.writer.writeAttribute(Tags.TYPE, element.getType());
}
@ -78,14 +80,18 @@ public abstract class AbstractToSaxWriterVisitor {
for (Parameter<?> parameter : parameters) {
writeStartStrolchElement(Tags.PARAMETER, true, parameter);
if (!Parameter.INTERPRETATION_NONE.equals(parameter.getInterpretation()))
if (!Parameter.INTERPRETATION_NONE.equals(parameter.getInterpretation())) {
this.writer.writeAttribute(Tags.INTERPRETATION, parameter.getInterpretation());
if (!Parameter.UOM_NONE.equals(parameter.getUom()))
}
if (!Parameter.UOM_NONE.equals(parameter.getUom())) {
this.writer.writeAttribute(Tags.UOM, parameter.getUom());
if (parameter.isHidden())
}
if (parameter.isHidden()) {
this.writer.writeAttribute(Tags.HIDDEN, Boolean.toString(parameter.isHidden()));
if (parameter.getIndex() != 0)
}
if (parameter.getIndex() != 0) {
this.writer.writeAttribute(Tags.INDEX, Integer.toString(parameter.getIndex()));
}
this.writer.writeAttribute(Tags.VALUE, parameter.getValueAsString());
}

View File

@ -31,15 +31,17 @@ public class SimpleStrolchElementListener implements StrolchElementListener {
@Override
public void notifyResource(Resource resource) {
if (this.resources == null)
if (this.resources == null) {
this.resources = new ArrayList<>();
}
this.resources.add(resource);
}
@Override
public void notifyOrder(Order order) {
if (this.orders == null)
if (this.orders == null) {
this.orders = new ArrayList<>();
}
this.orders.add(order);
}

View File

@ -61,14 +61,18 @@ public abstract class StrolchElementToDomVisitor {
AttributesImpl attributes = attributesFor((StrolchElement) parameter);
attributes.addAttribute(null, null, Tags.VALUE, Tags.CDATA, parameter.getValueAsString());
if (!Parameter.UOM_NONE.equals(parameter.getUom()))
if (!Parameter.UOM_NONE.equals(parameter.getUom())) {
attributes.addAttribute(null, null, Tags.UOM, Tags.CDATA, parameter.getUom());
if (!Parameter.INTERPRETATION_NONE.equals(parameter.getInterpretation()))
}
if (!Parameter.INTERPRETATION_NONE.equals(parameter.getInterpretation())) {
attributes.addAttribute(null, null, Tags.INTERPRETATION, Tags.CDATA, parameter.getInterpretation());
if (parameter.isHidden())
}
if (parameter.isHidden()) {
attributes.addAttribute(null, null, Tags.HIDDEN, Tags.CDATA, Boolean.toString(parameter.isHidden()));
if (parameter.getIndex() != 0)
}
if (parameter.getIndex() != 0) {
attributes.addAttribute(null, null, Tags.INDEX, Tags.CDATA, Integer.toString(parameter.getIndex()));
}
return attributes;
}

View File

@ -57,9 +57,10 @@ public class XmlModelSaxFileReader extends XmlModelSaxReader {
case Tags.INCLUDE_FILE:
String includeFileS = attributes.getValue(Tags.FILE);
if (StringHelper.isEmpty(includeFileS))
if (StringHelper.isEmpty(includeFileS)) {
throw new IllegalArgumentException(MessageFormat.format(
"The attribute {0} is missing for IncludeFile!", Tags.FILE)); //$NON-NLS-1$
}
File includeFile = new File(this.modelFile.getParentFile(), includeFileS);
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$

View File

@ -74,7 +74,6 @@ public class XmlModelSaxReader extends DefaultHandler {
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// TODO split each root object into its own file
switch (qName) {
case Tags.STROLCH_MODEL:
@ -201,6 +200,7 @@ public class XmlModelSaxReader extends DefaultHandler {
}
public static class XmlModelStatistics {
public Date startTime;
public long durationNanos;
public int nrOfResources;

View File

@ -71,8 +71,7 @@ public class FloatTimeVariableTest {
}
/**
* 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() {
@ -132,8 +131,7 @@ public class FloatTimeVariableTest {
}
/**
* 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() {