com.accountingenhancements.common
Class SupportParameters

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Object>
          extended by com.accountingenhancements.common.SupportParameters
All Implemented Interfaces:
java.io.Serializable, java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object>, java.util.Map<java.lang.String,java.lang.Object>

public class SupportParameters
extends java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Object>

Used to hand objects to functions within com.accountingenhancements.formula and in com.accountingenhancements.layouttools to handle various components.
In com.accountingenhancements.formula this class is used to pass objects, such as SQL database connections, to custom functions. It is passed though the solve(...) methods to the functions so that all functions have access to the required objects.
In com.accountingenhancements.layouttools this class is used to handle the components (Usually JComponents) that are to be layed out on panels.
This is a ConcurrentHashMap of objects. Make sure objects don't share the same key name! When used in custom functions, I suggest that you use the custom function as a portion of the key name to avoid conflicts. If the object is destined for multiple functions, put the object in here multiple times under the different key names. They doesn't take up that much memory compared to the risks of confusion faced later.
This map is handed through, from user code, untouched, to all FormulaFunctions. Use this when creating your own functions so that you can hand classes such as database connections, login info, or any other information, to your custom functions. The built in funcitons do not require this class so you can use null if this is not needed for your custom functions.
Both packages use upper case values of the key so that case doesn't matter
Example:
SqlQuery.function(String formula, FormulaVariableList variableList, int iteration, SupportParameters supportParameters, FormulaFunctionList functionList)
Where the supportParamters would have a java.sql.Connection class stored under a key name such as FunctionSqlQuery_java.sql.Connection.
In the layouttools package, the key names are used in the layout text. Example:
String layout = "\"City/St/Zip\",{group0|{FName, MName, LName}";
This class should then have 3 JComponents with the key names FName, MName, and LName.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
SupportParameters()
          Creates a new, empty map with a default initial capacity, load factor, and concurrencyLevel.
SupportParameters(int initialCapacity)
          Creates a new, empty map with the specified initial capacity, and with default load factor and concurrencyLevel.
SupportParameters(int initialCapacity, float loadFactor, int concurrencyLevel)
          Creates a new, empty map with the specified initial capacity, load factor, and concurrency level.
 
Method Summary
 javax.swing.JComponent getJComponent(java.lang.String key)
          Returns the Component value to which the specified upper case value of this key is mapped in this table.
 java.lang.Object getUpperCase(java.lang.String key)
          Returns the value to which the upper case value of this key is mapped in this table
 javax.swing.JComponent getUpperCaseJComponent(java.lang.String key)
          Returns the JComponent value to which the specified upper case value of this key is mapped in this table.
 java.lang.Object putUpperCase(java.lang.String key, java.lang.Object value)
          Maps the specified key to the specified value in this table.
 
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, contains, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

SupportParameters

public SupportParameters()
Creates a new, empty map with a default initial capacity, load factor, and concurrencyLevel.


SupportParameters

public SupportParameters(int initialCapacity)
                  throws java.lang.IllegalArgumentException
Creates a new, empty map with the specified initial capacity, and with default load factor and concurrencyLevel.

Parameters:
initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements
Throws:
java.lang.IllegalArgumentException - if the initial capacity of elements is negative

SupportParameters

public SupportParameters(int initialCapacity,
                         float loadFactor,
                         int concurrencyLevel)
Creates a new, empty map with the specified initial capacity, load factor, and concurrency level.

Parameters:
initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
loadFactor - the load factor threshhold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
concurrencyLevel - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is negative or the load factor or concurrencyLevel are nonpositive
Method Detail

getJComponent

public javax.swing.JComponent getJComponent(java.lang.String key)
                                     throws java.lang.NullPointerException
Returns the Component value to which the specified upper case value of this key is mapped in this table.

Parameters:
key - a key in the table
Returns:
the JComponent located in the table or null if the entry doesn't exist or is not assignable to JComponent
Throws:
java.lang.NullPointerException - if key is null

getUpperCaseJComponent

public javax.swing.JComponent getUpperCaseJComponent(java.lang.String key)
                                              throws java.lang.NullPointerException
Returns the JComponent value to which the specified upper case value of this key is mapped in this table.

Parameters:
key - a key in the table. This key will be converted to upper case
Returns:
the JComponent located in the table or null if the entry doesn't exist or is not assignable to JComponent
Throws:
java.lang.NullPointerException - if key is null

putUpperCase

public java.lang.Object putUpperCase(java.lang.String key,
                                     java.lang.Object value)
                              throws java.lang.NullPointerException
Maps the specified key to the specified value in this table. Neither the key nor the value can be null
The value can be retrieved by calling the get method with a key that is equal to the original key.toUpperCase()

Parameters:
key - the table key. This key will be converted to upper case
value - the value
Returns:
the previous value of the specified key in this table, or null if it did not have one.
Throws:
java.lang.NullPointerException - if key or value is null

getUpperCase

public java.lang.Object getUpperCase(java.lang.String key)
                              throws java.lang.NullPointerException
Returns the value to which the upper case value of this key is mapped in this table

Parameters:
key - a key in the table. This key will be converted to upper case
Returns:
the value to which the key is mapped in this table; null if the key is not mapped to any value in this table
Throws:
java.lang.NullPointerException - if the key is null