%%%%%%%%%%%%%%%%%%%%%%%%%%%begin%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Interfaces}

\subsection{CNVList}
\label{nvl:cnvlist}

\subsubsection{CNVList (String filename)}
\begin{quote}
Constructor which loads file filename.
\end{quote}

\subsubsection{CNVList()}
\begin{quote}
Empty constructor.
\end{quote}

\subsubsection{CNVList( CNVList copy)}
\begin{quote}
Copy constructor.
\end{quote}

\subsubsection{boolean add(name, value)}
\tspec{boolean add(String, boolean)}
\tspec{boolean add(String, int)}
\tspec{boolean add(String, double)}
\tspec{boolean add(String, String)}
\begin{quote}
Adds to the CNVList the name-value pair, the type is automatically 
saved to the list too. The identifier is name-type, thus different
values with the same name and a different type can be added to the
same list (e.g. add("whatever", (int)3) add("whatever", (double)4.5)).\\
Return is true if the value was correctly written to the list, and 
false if a collision occured.
\end{quote}

\subsubsection{int add( CNVList insert)}
\begin{quote}
Adds all elements of insert to the list.\\
Currently always returns (int)0.
\end{quote}

\subsubsection{int addext( CNVList what, int how)}
\begin{quote}
Adds the CNVList what to the list, when an item of what does not exist in 
the list it is added, if it exists how manages what happens. Currently
how can be one of the following:
\begin{verbatim}
        CNVList.CHANGE
        CNVList.SKIP
\end{verbatim}
On CHANGE the item is changed, on SKIP the item is ignored.
Return value is currently always 1.
\end{quote}

\subsubsection{boolean add(name, o, info)}
\tspec{add(String, int, String)}
\tspec{add(String, double, String)}
\tspec{add(String, String, String)}
\tspec{add(String, boolean, String)}
\begin{quote}
Best explained via pseudo code:
\begin{verbatim}
        add(name, o)
        addInfo(info)
        return
\end{verbatim}
Returns false if add fails, and true in all other cases.
\end{quote}

\subsubsection{boolean add(name, o, info, min, max)}
\tspec{add(String, int, String, int, int)}
\tspec{add(String, double, String, double, double)}
\begin{quote}
Best explained via pseudo code:
\begin{verbatim}
        add(name, o)
        addInfo( info)
        addMin( min)
        addMax( max)
        return
\end{verbatim}
Returns false if add fails, and true in all other cases.
\end{quote}

\subsubsection{boolean addInfo(String )}


\begin{quote}
Adds the info to the current item, returns false if there is no current 
item, or true in all other cases.
\end{quote}

\subsubsection{boolean addMin(min)}
\tspec{addMin(double)}
\tspec{addMin(int)}
\begin{quote}
Adds the given minimum to the current item, returns false if there is 
no current item, or if the value does not fit the current type (e.g.:
integer minimum for double value), returns true in all other cases.
\end{quote}

\subsubsection{boolean addMax(max)}
\tspec{addMax(double)}
\tspec{addMax(int)}
\begin{quote}
Adds the given maximum to the current item, returns false if there is 
no current item, or if the value does not fit the current type (e.g.:
double maximum for integer value), returns true in all other cases.
\end{quote}

\subsubsection{boolean search(name, type)}
\tspec{boolean search( String, int)}
\label{nvl:search}
\begin{quote}
Searches for a name type pair and returns true if the pair was found,
and false if it was not found. The index of the found value is saved, 
and the value can then be retrieved using the various get functions.
NOTE: if search results in false a standard value should be used.
The byte type are static final variables in the CNVPair class as
follows:
\begin{verbatim}
    int        CNVPair.INT
    String     CNVPair.STRING
    double     CNVPair.DOUBLE
    boolean    CNVPair.BOOLEAN
\end{verbatim}
\end{quote}

\subsubsection{$<$type$>$ get$<$Type$>$()}
\tspec{int getInt()}
\tspec{String getString()}
\tspec{double getDouble()}
\tspec{boolean getBoolean()}
 

\begin{quote}
Returns the value at the current index (as found by search), if the
wrong type is requested standard values are returned as follows:
\begin{verbatim}
    int       (int)0
    String    null
    double    (double)0
    boolean   false
\end{verbatim}
else it returns the requested value.
\end{quote}

\subsubsection{boolean stepon()}
\begin{quote}
Sets step mode on, and index to 0;
NOTE: when step mode is switched on the search() function is disabled.\\
Returns true if the list is not empty, and
false in all other cases.
\end{quote}

\subsubsection{void stepoff()}
\begin{quote}
Switches next() off, and search on.
\end{quote}

\subsubsection{boolean next()}
\begin{quote}
Goes to next item and returns true. If at end of list or step is off it
returns false.
\end{quote}

\subsubsection{String getName()}
\begin{quote}
Returns the name of the current item.
\end{quote}

\subsubsection{int getType()}
\begin{quote}
Returns the type of the current CNVPair.
\end{quote}

\subsubsection{boolean change(name, value)}
\tspec{boolean change(String, boolean)}
\tspec{boolean change(String, int)}
\tspec{boolean change(String, double)}
\tspec{boolean change(String, String)}
\begin{quote}
Changes the current entry to name, value (type is automatically distinguished).
The olf value is lost!
This also resets the info, min and max values.
\end{quote}

\subsubsection{CNVList get()}
\begin{quote}
Returns a CNVList with the current item.
\end{quote}

\subsubsection{boolean isInfo()}
\begin{quote}
Returns true if info is available, and false in all other cases.
\end{quote}

\subsubsection{boolean isMin()}
\begin{quote}
Returns true if a minimum value is given, and false in all other cases.
\end{quote}

\subsubsection{boolean isMax()}
\begin{quote}
Returns true if a maximum value is given, and false in all other cases.
\end{quote}

\subsubsection{String getInfo()}
\begin{quote}
Returns null if no current item, or if there is no info set, otherwise it 
returns the info. 
\end{quote}

\subsubsection{$<$type$>$ getMin$<$Type$>$()}
\tspec{int getMinInt()}
\tspec{double getMinDouble()}
\begin{quote}
Returns the min value if one exists and (type)0 otherwise.
\end{quote}

\subsubsection{$<$type$>$ getMax$<$Type$>$()}
\tspec{int getMaxInt()}
\tspec{double getMinDouble()}
\begin{quote}
Returns the max value if one exists and (type)0 otherwise.
\end{quote}

\subsubsection{void print()}
\begin{quote}
Steps through the list and prints out all items, in the form:
\begin{verbatim}
        MyName(INT) = 5, min = 4, max = 7
            This is the info for this example...
        HisName(INT) = 9, min = 0
            Info for HisName
\end{verbatim}
\end{quote}

\subsubsection{boolean isNotEmpty()}
\begin{quote}
Returns false if list is empty and true in all other cases.
\end{quote}

\subsubsection{boolean isEmpty()}
\begin{quote}
Returns true if the list is empty, true in all other cases.
\end{quote}

\subsubsection{boolean saveXML( String filename)}
\begin{quote}
Saves the entire list to the file filename in the form:
\begin{verbatim}
    <CNVList version="3" build="0">
        <item name="intforyou" type="INT">
            <value>326</value>
            <min>2</min>
            <max>532</max>
            <info>if there are no min or max values in the list they are also
                missing completely in the xml file (same for info)</info>
        </item>
        <item name="double" type="DOUBLE">
            <value>7.45</value>
            <info>when there are no min max values it looks like this</info>
        </item>
        <item name="noinfo" type="BOOLEAN">
            <value>true</value>
        </item>
        <item name="finally" type="STRING">
             <value>string with info</value>
            <info>asdf</info>
        </item>
        <item name="etc" type="STRING">
            <value>...</value>
                </item>
            </cnvlIST>
\end{verbatim}
Returns true on successful save, and false in all other cases.

\end{quote}


\subsubsection{boolean loadXML( String filename)}
\begin{quote}
Reads a xml file as per saveXML. Returns false if there was major problem
(exception) and true on a successful load.
\end{quote}



\subsubsection{boolean change( name, o, info)}
\tspec{ change(String, boolen, String)}
\tspec{ change(String, int, String)}
\tspec{ change(String, double, String)}
\tspec{ change(String, String, String)}
\begin{quote}
The current value is lost, and the new value with info is added.
\end{quote}


%%%%%%%%%%%%% CNVPAIR %%%%%%%%%%%%%%%%%%%
\subsection{CNVPair}
\label{nvl:cnvpair}
This class should only be accessed through CNVList (see page \pageref{nvl:cnvlist}).
The only part of importance for the user are the constants that define the 
type, as needed for CNVList.search (see page \pageref{nvl:search}):
\begin{verbatim}
    int     INT
    String  STRING
    double  DOUBLE
    boolean BOOLEAN
\end{verbatim}
