From fae58d2173039e70ad94075d49c0c500e935e454 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 27 May 2008 18:30:07 +0000 Subject: Refactored a bit. --- sources/prefs/VSPrefs.java | 98 +++++----------------------------------------- 1 file changed, 10 insertions(+), 88 deletions(-) (limited to 'sources/prefs/VSPrefs.java') diff --git a/sources/prefs/VSPrefs.java b/sources/prefs/VSPrefs.java index cac3b18..abd6381 100644 --- a/sources/prefs/VSPrefs.java +++ b/sources/prefs/VSPrefs.java @@ -49,7 +49,7 @@ public class VSPrefs implements Serializable { private HashMap longPrefs; /** The setting restriction prefs. */ - private HashMap restrictions; + private HashMap restrictions; /** The description prefs. */ private HashMap descriptionPrefs; @@ -78,85 +78,6 @@ public class VSPrefs implements Serializable { /** The id. */ protected long id; - /** - * The Class VSPrefRestriction. - */ - public class VSPrefRestriction implements Serializable { - private static final long serialVersionUID = 1L; - } - - /** - * The Class VSIntegerPrefRestriction. - */ - public class VSIntegerPrefRestriction extends VSPrefRestriction { - private static final long serialVersionUID = 1L; - /** The min value. */ - private int minValue; - - /** The max value. */ - private int maxValue; - - /** - * Instantiates a new integer setting restriction. - * - * @param minValue the min value - * @param maxValue the max value - */ - public VSIntegerPrefRestriction(int minValue, int maxValue) { - this.minValue = minValue; - this.maxValue = maxValue; - } - - /** - * Gets the min value. - * - * @return the min value - */ - public int getMinValue() { - return minValue; - } - - /** - * Gets the max value. - * - * @return the max value - */ - public int getMaxValue() { - return maxValue; - } - } - - /** - * The Class StringVSPrefRestriction. - */ - public class StringVSPrefRestriction extends VSPrefRestriction { - private static final long serialVersionUID = 1L; - - /** The possible selections. */ - Vector possibleSelections; - - /** - * Instantiates a new string setting restriction. - * - * @param possibleSelections the possible selections - */ - public StringVSPrefRestriction(String [] possibleSelections) { - this.possibleSelections = new Vector(); - - for (String elem : possibleSelections) - this.possibleSelections.add(elem); - } - - /** - * Gets the possible selections. - * - * @return the possible selections - */ - public Vector getPossibleSelections() { - return possibleSelections; - } - } - /** * Instantiates a new lang.process.removeprefs. */ @@ -167,7 +88,7 @@ public class VSPrefs implements Serializable { integerPrefs = new HashMap(); vectorPrefs = new HashMap>(); longPrefs = new HashMap(); - restrictions = new HashMap(); + restrictions = new HashMap(); stringPrefs = new HashMap(); booleanPrefs = new HashMap(); objectPrefs = new HashMap(); @@ -249,7 +170,7 @@ public class VSPrefs implements Serializable { * * @return the restriction */ - public synchronized VSPrefRestriction getRestriction(String fullKey) { + public synchronized VSPrefsRestriction getRestriction(String fullKey) { return restrictions.get(fullKey); } @@ -259,7 +180,7 @@ public class VSPrefs implements Serializable { * @param key the key * @param settingRestriction the setting restriction */ - public synchronized void initRestriction(String key, VSPrefRestriction settingRestriction) { + public synchronized void initRestriction(String key, VSPrefsRestriction settingRestriction) { restrictions.put(key, settingRestriction); } @@ -648,7 +569,7 @@ public class VSPrefs implements Serializable { * @param descr the descr * @param r the restriction */ - public void initInteger(String key, int val, String descr, VSIntegerPrefRestriction r) { + public void initInteger(String key, int val, String descr, VSPrefsRestriction.VSIntegerPrefRestriction r) { initInteger(key, val, descr); initRestriction(INTEGER_PREFIX + key, r); } @@ -661,7 +582,7 @@ public class VSPrefs implements Serializable { * @param descr the descr * @param r the restriction */ - public void initInteger(String key, int val, String descr, VSIntegerPrefRestriction r, String unit) { + public void initInteger(String key, int val, String descr, VSPrefsRestriction.VSIntegerPrefRestriction r, String unit) { initInteger(key, val, descr, r); initUnit(INTEGER_PREFIX + key, unit); } @@ -676,7 +597,8 @@ public class VSPrefs implements Serializable { * @param maxValue the max value */ public void initInteger(String key, int val, String descr, int minValue, int maxValue) { - initInteger(key, val, descr, new VSIntegerPrefRestriction(minValue, maxValue)); + initInteger(key, val, descr, + new VSPrefsRestriction.VSIntegerPrefRestriction(minValue, maxValue)); } /** @@ -1026,7 +948,7 @@ public class VSPrefs implements Serializable { integerPrefs = (HashMap) objectInputStream.readObject(); vectorPrefs = (HashMap>) objectInputStream.readObject(); longPrefs = (HashMap) objectInputStream.readObject(); - restrictions = new HashMap(); + restrictions = new HashMap(); stringPrefs = (HashMap) objectInputStream.readObject(); units = (HashMap) objectInputStream.readObject(); } @@ -1076,7 +998,7 @@ public class VSPrefs implements Serializable { for (String key : keys) copyInto.initInteger(key, getInteger(key), getDescription(INTEGER_PREFIX + key), - (VSIntegerPrefRestriction) getRestriction(INTEGER_PREFIX + key), + (VSPrefsRestriction.VSIntegerPrefRestriction) getRestriction(INTEGER_PREFIX + key), getUnit(INTEGER_PREFIX + key)); } -- cgit v1.2.3