[Minor] Fix compile warnings

This commit is contained in:
Robert von Burg 2017-09-26 15:01:02 +02:00
parent 0c8b40c10a
commit 3310bb8766
6 changed files with 18 additions and 33 deletions

View File

@ -32,14 +32,6 @@ public class AndSelector<T extends StrolchElement> extends BooleanSelector<T> {
super(selectors);
}
public AndSelector(@SuppressWarnings("unchecked") Selector<T>... selector) {
super(selector);
}
public AndSelector(Selector<T> leftHandSide, Selector<T> rightHandSide) {
super(leftHandSide, rightHandSide);
}
@Override
public AndSelector<T> with(Selector<T> selector) {
super.with(selector);

View File

@ -32,7 +32,6 @@ public abstract class BooleanSelector<T extends StrolchElement> implements Selec
this.selectors = new ArrayList<>(1);
}
@SafeVarargs
public BooleanSelector(Selector<T>... selector) {
this.selectors = Arrays.asList(selector);
}

View File

@ -26,14 +26,10 @@ public class AndSelection extends BooleanSelection {
super();
}
@SafeVarargs
public AndSelection(Selection... selections) {
super(selections);
}
/**
* @param selections
*/
public AndSelection(List<Selection> selections) {
super(selections);
}

View File

@ -30,7 +30,6 @@ public class OrSelection extends BooleanSelection {
super(selections);
}
@SafeVarargs
public OrSelection(Selection... selections) {
super(selections);
}

View File

@ -64,7 +64,6 @@ public class XmlModelSaxReader extends DefaultHandler {
private Deque<Activity> activityStack;
private ParameterBag pBag;
private StrolchTimedState<? extends IValue<?>> 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$
}
}
}

View File

@ -145,7 +145,7 @@ public class Paging<T> {
} 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);
}