diff --git a/prism/src/settings/NumericConstraint.java b/prism/src/settings/NumericConstraint.java index e8afd6ed..0ceb908d 100644 --- a/prism/src/settings/NumericConstraint.java +++ b/prism/src/settings/NumericConstraint.java @@ -44,6 +44,10 @@ public abstract class NumericConstraint implements SettingConstraint { checkValueInteger(((Integer)value).intValue()); } + else if(value instanceof Long) + { + checkValueLong(((Long)value).longValue()); + } else { throw new SettingException("Invalid type for property, should be numeric."); @@ -54,4 +58,5 @@ public abstract class NumericConstraint implements SettingConstraint public abstract void checkValueInteger(int value) throws SettingException; + public abstract void checkValueLong(long value) throws SettingException; } diff --git a/prism/src/settings/RangeConstraint.java b/prism/src/settings/RangeConstraint.java index caa3613d..4fc0eeca 100644 --- a/prism/src/settings/RangeConstraint.java +++ b/prism/src/settings/RangeConstraint.java @@ -151,4 +151,24 @@ public class RangeConstraint extends NumericConstraint } } + public void checkValueLong(long value) throws SettingException + { + if(inclusiveLower) + { + if(value < lower) throw new SettingException("The value: "+value+" should be >="+(long)lower); + } + else + { + if(value <= lower) throw new SettingException("The value: "+value+" should be >"+(long)lower); + } + + if(inclusiveUpper) + { + if(value > upper) throw new SettingException("The value: "+value+"should be <="+(long)upper); + } + else + { + if(value >= upper) throw new SettingException("The value: "+value+"should be <"+(long)upper); + } + } } diff --git a/prism/src/userinterface/graph/AxisSettings.java b/prism/src/userinterface/graph/AxisSettings.java index 64c61b21..eba92be3 100644 --- a/prism/src/userinterface/graph/AxisSettings.java +++ b/prism/src/userinterface/graph/AxisSettings.java @@ -146,11 +146,16 @@ public class AxisSettings extends Observable implements SettingOwner { if(activated && d >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); } - - public void checkValueInteger(int i) throws SettingException - { - if(activated && i >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); - } + + public void checkValueInteger(int i) throws SettingException + { + if(activated && i >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); + } + + public void checkValueLong(long i) throws SettingException + { + if(activated && i >= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be < Maximum value"); + } }); maxValue.addConstraint(new NumericConstraint() { @@ -163,6 +168,11 @@ public class AxisSettings extends Observable implements SettingOwner { if(activated && i <= minValue.getDoubleValue()) throw new SettingException("Maximum value should be > Minimum value"); } + + public void checkValueLong(long i) throws SettingException + { + if(activated && i <= maxValue.getDoubleValue()) throw new SettingException("Minimum value should be > Maximum value"); + } }); minimumPower.addConstraint(new NumericConstraint() { @@ -170,11 +180,16 @@ public class AxisSettings extends Observable implements SettingOwner { if(activated && d >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); } - - public void checkValueInteger(int i) throws SettingException - { - if(activated && i >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); - } + + public void checkValueInteger(int i) throws SettingException + { + if(activated && i >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); + } + + public void checkValueLong(long i) throws SettingException + { + if(activated && i >= maximumPower.getDoubleValue()) throw new SettingException("Minimum power should be < Maximum power"); + } }); maximumPower.addConstraint(new NumericConstraint() { @@ -182,8 +197,13 @@ public class AxisSettings extends Observable implements SettingOwner { if(activated && d <= minimumPower.getDoubleValue()) throw new SettingException("Maximum power should be > Minimum power"); } + + public void checkValueInteger(int i) throws SettingException + { + if(activated && i <= minimumPower.getDoubleValue()) throw new SettingException("Maximum power should be > Minimum power"); + } - public void checkValueInteger(int i) throws SettingException + public void checkValueLong(long i) throws SettingException { if(activated && i <= minimumPower.getDoubleValue()) throw new SettingException("Maximum power should be > Minimum power"); }