[New] added ListParameter.addAllValues

This commit is contained in:
Robert von Burg 2018-10-05 11:18:05 +02:00
parent b6819c4b47
commit fc896be5b5
6 changed files with 66 additions and 34 deletions

View File

@ -106,6 +106,12 @@ public class FloatListParameter extends AbstractParameter<List<Double>> implemen
this.value.add(value); this.value.add(value);
} }
@Override
public void addAllValues(List<Double> values) {
assertNotReadonly();
this.value.addAll(values);
}
@Override @Override
public boolean addValueIfNotContains(Double value) { public boolean addValueIfNotContains(Double value) {
assertNotReadonly(); assertNotReadonly();

View File

@ -106,6 +106,12 @@ public class IntegerListParameter extends AbstractParameter<List<Integer>> imple
this.value.add(value); this.value.add(value);
} }
@Override
public void addAllValues(List<Integer> values) {
assertNotReadonly();
this.value.addAll(values);
}
@Override @Override
public boolean addValueIfNotContains(Integer value) { public boolean addValueIfNotContains(Integer value) {
assertNotReadonly(); assertNotReadonly();

View File

@ -24,8 +24,8 @@ import java.util.List;
*/ */
public interface ListParameter<E> extends Parameter<List<E>> { public interface ListParameter<E> extends Parameter<List<E>> {
public static final String VALUE_SEPARATOR1 = ";"; //$NON-NLS-1$ String VALUE_SEPARATOR1 = ";"; //$NON-NLS-1$
public static final String VALUE_SEPARATOR2 = ","; //$NON-NLS-1$ String VALUE_SEPARATOR2 = ","; //$NON-NLS-1$
/** /**
* Adds a single value to the {@link List} of values * Adds a single value to the {@link List} of values
@ -33,7 +33,15 @@ public interface ListParameter<E> extends Parameter<List<E>> {
* @param value * @param value
* the value to add * the value to add
*/ */
public void addValue(E value); void addValue(E value);
/**
* Adds the given values to the {@link List} of values
*
* @param values
* the values to add
*/
void addAllValues(List<E> values);
/** /**
* Adds a single value to the {@link List} of values if the current list does not already contain the value * Adds a single value to the {@link List} of values if the current list does not already contain the value
@ -41,7 +49,7 @@ public interface ListParameter<E> extends Parameter<List<E>> {
* @param value * @param value
* the value to add * the value to add
*/ */
public boolean addValueIfNotContains(E value); boolean addValueIfNotContains(E value);
/** /**
* Removes a single value from the {@link List} of values * Removes a single value from the {@link List} of values
@ -51,26 +59,26 @@ public interface ListParameter<E> extends Parameter<List<E>> {
* *
* @return true if the value was removed, false if it did not exist * @return true if the value was removed, false if it did not exist
*/ */
public boolean removeValue(E value); boolean removeValue(E value);
/** /**
* Clears the list of values, i.e the list of values is empty after this call * Clears the list of values, i.e the list of values is empty after this call
*/ */
public void clear(); void clear();
/** /**
* Returns true if the list of values is empty, false if not * Returns true if the list of values is empty, false if not
* *
* @return true if the list of values is empty, false if not * @return true if the list of values is empty, false if not
*/ */
public boolean isEmpty(); boolean isEmpty();
/** /**
* Returns the size of the list of values * Returns the size of the list of values
* *
* @return the size of the list of values * @return the size of the list of values
*/ */
public int size(); int size();
/** /**
* Returns true if the list of values contains the given element, false if not * Returns true if the list of values contains the given element, false if not
@ -80,7 +88,7 @@ public interface ListParameter<E> extends Parameter<List<E>> {
* *
* @return true if the list of values contains the given element, false if not * @return true if the list of values contains the given element, false if not
*/ */
public boolean contains(E value); boolean contains(E value);
/** /**
* Returns true if the list of values contains all of the given elements, false if not * Returns true if the list of values contains all of the given elements, false if not
@ -90,5 +98,5 @@ public interface ListParameter<E> extends Parameter<List<E>> {
* *
* @return true if the list of values contains all of the given elements, false if not * @return true if the list of values contains all of the given elements, false if not
*/ */
public boolean containsAll(List<E> values); boolean containsAll(List<E> values);
} }

View File

@ -106,6 +106,12 @@ public class LongListParameter extends AbstractParameter<List<Long>> implements
this.value.add(value); this.value.add(value);
} }
@Override
public void addAllValues(List<Long> values) {
assertNotReadonly();
this.value.addAll(values);
}
@Override @Override
public boolean addValueIfNotContains(Long value) { public boolean addValueIfNotContains(Long value) {
assertNotReadonly(); assertNotReadonly();

View File

@ -30,7 +30,7 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* *
* @return the value as string * @return the value as string
*/ */
public String getValueAsString(); String getValueAsString();
/** /**
* Set the value of the parameter from a string * Set the value of the parameter from a string
@ -38,14 +38,14 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param valueAsString * @param valueAsString
* the string from which to set the value * the string from which to set the value
*/ */
public void setValueFromString(String valueAsString); void setValueFromString(String valueAsString);
/** /**
* the value of the parameter * the value of the parameter
* *
* @return the value * @return the value
*/ */
public <U extends T> U getValue(); <U extends T> U getValue();
/** /**
* set the value of the parameter * set the value of the parameter
@ -53,7 +53,7 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param value * @param value
* the new value * the new value
*/ */
public void setValue(T value); void setValue(T value);
/** /**
* set the value of the parameter from another value, i.e. copying the value * set the value of the parameter from another value, i.e. copying the value
@ -61,18 +61,18 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param parameter * @param parameter
* the parameter from which to copy the new value * the parameter from which to copy the new value
*/ */
public void setValueFrom(Parameter<T> parameter); void setValueFrom(Parameter<T> parameter);
/** /**
* Clears the value, dependent on the concrete class * Clears the value, dependent on the concrete class
*/ */
public void clear(); void clear();
/** /**
* @return true if the value is empty, i.e. if the value is the same as the value which would be set if {@link * @return true if the value is empty, i.e. if the value is the same as the value which would be set if {@link
* #clear()} was called * #clear()} was called
*/ */
public boolean isEmpty(); boolean isEmpty();
/** /**
* Returns true if the given parameter's value is equal to the current value * Returns true if the given parameter's value is equal to the current value
@ -82,7 +82,7 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* *
* @return true if the given parameter's value is equal to the current value * @return true if the given parameter's value is equal to the current value
*/ */
public boolean isEqualTo(Parameter<T> otherValue); boolean isEqualTo(Parameter<T> otherValue);
/** /**
* Returns true if the given value is equal to the current value * Returns true if the given value is equal to the current value
@ -92,14 +92,14 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* *
* @return true if the given value is equal to the current value * @return true if the given value is equal to the current value
*/ */
public boolean isEqualTo(T otherValue); boolean isEqualTo(T otherValue);
/** /**
* get the hidden attribute * get the hidden attribute
* *
* @return hidden value * @return hidden value
*/ */
public boolean isHidden(); boolean isHidden();
/** /**
* set the hidden attribute * set the hidden attribute
@ -107,14 +107,14 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param hidden * @param hidden
* new hidden value * new hidden value
*/ */
public void setHidden(boolean hidden); void setHidden(boolean hidden);
/** /**
* Get the UOM of this {@link Parameter} * Get the UOM of this {@link Parameter}
* *
* @return the UOM * @return the UOM
*/ */
public String getUom(); String getUom();
/** /**
* Set the UOM of this {@link Parameter} * Set the UOM of this {@link Parameter}
@ -122,14 +122,14 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param uom * @param uom
* the new UOM * the new UOM
*/ */
public void setUom(String uom); void setUom(String uom);
/** /**
* Returns the index of this {@link Parameter}. This can be used to sort the parameters in a UI * Returns the index of this {@link Parameter}. This can be used to sort the parameters in a UI
* *
* @return the index of this {@link Parameter}. This can be used to sort the parameters in a UI * @return the index of this {@link Parameter}. This can be used to sort the parameters in a UI
*/ */
public int getIndex(); int getIndex();
/** /**
* Set the index of this {@link Parameter}. This can be used to sort the parameters in a UI * Set the index of this {@link Parameter}. This can be used to sort the parameters in a UI
@ -137,7 +137,7 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param index * @param index
* the index to set * the index to set
*/ */
public void setIndex(int index); void setIndex(int index);
/** /**
* Returns the interpretation of this {@link Parameter}. The interpretation semantic describes what the value of * Returns the interpretation of this {@link Parameter}. The interpretation semantic describes what the value of
@ -150,7 +150,7 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* *
* @return string value * @return string value
*/ */
public String getInterpretation(); String getInterpretation();
/** /**
* Set the interpretation of this {@link Parameter}. The interpretation semantic describes what the value of this * Set the interpretation of this {@link Parameter}. The interpretation semantic describes what the value of this
@ -164,7 +164,7 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @param interpretation * @param interpretation
* the interpretation * the interpretation
*/ */
public void setInterpretation(String interpretation); void setInterpretation(String interpretation);
/** /**
* The {@link ParameterizedElement} parent to which this {@link Parameter} belongs * The {@link ParameterizedElement} parent to which this {@link Parameter} belongs
@ -172,27 +172,27 @@ public interface Parameter<T> extends StrolchElement, Comparable<Parameter<?>> {
* @return the parent * @return the parent
*/ */
@Override @Override
public ParameterizedElement getParent(); ParameterizedElement getParent();
/** /**
* Sets the parent for this {@link Parameter} * Sets the parent for this {@link Parameter}
*/ */
public void setParent(ParameterizedElement parent); void setParent(ParameterizedElement parent);
@Override @Override
public int hashCode(); int hashCode();
@Override @Override
public boolean equals(Object obj); boolean equals(Object obj);
@Override @Override
public int compareTo(Parameter<?> o); int compareTo(Parameter<?> o);
@Override @Override
public Parameter<T> getClone(); Parameter<T> getClone();
/** /**
* @return the {@link StrolchValueType} * @return the {@link StrolchValueType}
*/ */
public StrolchValueType getValueType(); StrolchValueType getValueType();
} }

View File

@ -106,6 +106,12 @@ public class StringListParameter extends AbstractParameter<List<String>> impleme
this.value.add(value); this.value.add(value);
} }
@Override
public void addAllValues(List<String> values) {
assertNotReadonly();
this.value.addAll(values);
}
@Override @Override
public boolean addValueIfNotContains(String value) { public boolean addValueIfNotContains(String value) {
assertNotReadonly(); assertNotReadonly();