diff --git a/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/AndSelector.java b/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/AndSelector.java index 8ae4f9087..100a7fb43 100644 --- a/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/AndSelector.java +++ b/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/AndSelector.java @@ -32,14 +32,6 @@ public class AndSelector extends BooleanSelector { super(selectors); } - public AndSelector(@SuppressWarnings("unchecked") Selector... selector) { - super(selector); - } - - public AndSelector(Selector leftHandSide, Selector rightHandSide) { - super(leftHandSide, rightHandSide); - } - @Override public AndSelector with(Selector selector) { super.with(selector); diff --git a/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/BooleanSelector.java b/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/BooleanSelector.java index 67e879c01..6f710ae52 100644 --- a/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/BooleanSelector.java +++ b/li.strolch.agent/src/main/java/li/strolch/runtime/query/inmemory/BooleanSelector.java @@ -32,7 +32,6 @@ public abstract class BooleanSelector implements Selec this.selectors = new ArrayList<>(1); } - @SafeVarargs public BooleanSelector(Selector... selector) { this.selectors = Arrays.asList(selector); } diff --git a/li.strolch.model/src/main/java/li/strolch/model/query/AndSelection.java b/li.strolch.model/src/main/java/li/strolch/model/query/AndSelection.java index 877ba4f50..9ece8189a 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/query/AndSelection.java +++ b/li.strolch.model/src/main/java/li/strolch/model/query/AndSelection.java @@ -26,14 +26,10 @@ public class AndSelection extends BooleanSelection { super(); } - @SafeVarargs public AndSelection(Selection... selections) { super(selections); } - /** - * @param selections - */ public AndSelection(List selections) { super(selections); } diff --git a/li.strolch.model/src/main/java/li/strolch/model/query/OrSelection.java b/li.strolch.model/src/main/java/li/strolch/model/query/OrSelection.java index e2b0d582c..813274f95 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/query/OrSelection.java +++ b/li.strolch.model/src/main/java/li/strolch/model/query/OrSelection.java @@ -30,7 +30,6 @@ public class OrSelection extends BooleanSelection { super(selections); } - @SafeVarargs public OrSelection(Selection... selections) { super(selections); } diff --git a/li.strolch.model/src/main/java/li/strolch/model/xml/XmlModelSaxReader.java b/li.strolch.model/src/main/java/li/strolch/model/xml/XmlModelSaxReader.java index 5fa284137..3d1077e2d 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/xml/XmlModelSaxReader.java +++ b/li.strolch.model/src/main/java/li/strolch/model/xml/XmlModelSaxReader.java @@ -64,7 +64,6 @@ public class XmlModelSaxReader extends DefaultHandler { private Deque activityStack; private ParameterBag pBag; private StrolchTimedState> state; - private StrolchValueType stateType; private PolicyDefs policies; public XmlModelSaxReader(StrolchElementListener listener) { @@ -94,9 +93,8 @@ public class XmlModelSaxReader extends DefaultHandler { String resId = attributes.getValue(Tags.ID); String resName = attributes.getValue(Tags.NAME); String resType = attributes.getValue(Tags.TYPE); - Resource resource = new Resource(resId, resName, resType); - this.parameterizedElement = resource; + this.parameterizedElement = new Resource(resId, resName, resType); break; @@ -172,8 +170,7 @@ public class XmlModelSaxReader extends DefaultHandler { String pBagId = attributes.getValue(Tags.ID); String pBagName = attributes.getValue(Tags.NAME); String pBagType = attributes.getValue(Tags.TYPE); - ParameterBag pBag = new ParameterBag(pBagId, pBagName, pBagType); - this.pBag = pBag; + this.pBag = new ParameterBag(pBagId, pBagName, pBagType); break; @@ -189,8 +186,7 @@ public class XmlModelSaxReader extends DefaultHandler { String paramIndexS = attributes.getValue(Tags.INDEX); int index = StringHelper.isEmpty(paramIndexS) ? 0 : Integer.valueOf(paramIndexS); - boolean paramHidden = StringHelper.isEmpty(paramHiddenS) ? false - : StringHelper.parseBoolean(paramHiddenS); + boolean paramHidden = !StringHelper.isEmpty(paramHiddenS) && StringHelper.parseBoolean(paramHiddenS); String paramUom = attributes.getValue(Tags.UOM); String paramInterpretation = attributes.getValue(Tags.INTERPRETATION); @@ -209,8 +205,9 @@ public class XmlModelSaxReader extends DefaultHandler { this.pBag.addParameter(param); } catch (Exception e) { - throw new StrolchException("Failed to instantiate parameter " + paramId + " for bag " - + this.pBag.getLocator() + " due to " + e.getMessage(), e); + throw new StrolchException( + "Failed to instantiate parameter " + paramId + " for bag " + this.pBag.getLocator() + " due to " + + e.getMessage(), e); } break; @@ -220,17 +217,16 @@ public class XmlModelSaxReader extends DefaultHandler { String stateId = attributes.getValue(Tags.ID); try { String stateName = attributes.getValue(Tags.NAME); - String stateType = attributes.getValue(Tags.TYPE); + String stateTypeS = attributes.getValue(Tags.TYPE); String stateHiddenS = attributes.getValue(Tags.HIDDEN); String stateIndexS = attributes.getValue(Tags.INDEX); String stateUom = attributes.getValue(Tags.UOM); String stateInterpretation = attributes.getValue(Tags.INTERPRETATION); int stateIndex = StringHelper.isEmpty(stateIndexS) ? 0 : Integer.valueOf(stateIndexS); - boolean stateHidden = StringHelper.isEmpty(stateHiddenS) ? false - : StringHelper.parseBoolean(stateHiddenS); + boolean stateHidden = !StringHelper.isEmpty(stateHiddenS) && StringHelper.parseBoolean(stateHiddenS); - this.stateType = StrolchValueType.parse(stateType); - this.state = this.stateType.timedStateInstance(); + StrolchValueType stateType = StrolchValueType.parse(stateTypeS); + this.state = stateType.timedStateInstance(); this.state.setId(stateId); this.state.setName(stateName); this.state.setIndex(stateIndex); @@ -239,8 +235,9 @@ public class XmlModelSaxReader extends DefaultHandler { this.state.setUom(stateUom); } catch (Exception e) { - throw new StrolchException("Failed to instantiate TimedState " + stateId + " for resource " - + this.parameterizedElement.getLocator() + " due to " + e.getMessage(), e); + throw new StrolchException( + "Failed to instantiate TimedState " + stateId + " for resource " + this.parameterizedElement + .getLocator() + " due to " + e.getMessage(), e); } break; @@ -294,7 +291,8 @@ public class XmlModelSaxReader extends DefaultHandler { break; default: - throw new IllegalArgumentException(MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$ + throw new IllegalArgumentException( + MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$ } } @@ -378,7 +376,8 @@ public class XmlModelSaxReader extends DefaultHandler { break; default: - throw new IllegalArgumentException(MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$ + throw new IllegalArgumentException( + MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$ } } } diff --git a/li.strolch.utils/src/main/java/li/strolch/utils/collections/Paging.java b/li.strolch.utils/src/main/java/li/strolch/utils/collections/Paging.java index 2291630e5..f11b3a2ba 100644 --- a/li.strolch.utils/src/main/java/li/strolch/utils/collections/Paging.java +++ b/li.strolch.utils/src/main/java/li/strolch/utils/collections/Paging.java @@ -145,7 +145,7 @@ public class Paging { } else { - paging.lastOffset = paging.size % limit == 0 ? paging.size - limit : ((int) paging.size / limit) * limit; + paging.lastOffset = paging.size % limit == 0 ? paging.size - limit : (paging.size / limit) * limit; paging.nextOffset = Math.min(paging.lastOffset, limit + offset); paging.previousOffset = Math.max(0, offset - limit); }