norsys.netica
Class Environ

java.lang.Object
  |
  +--norsys.netica.Environ

public class Environ
extends java.lang.Object

The background environment for all Netica operations.

Since:
2.08

Field Summary
static int COMPLETE_CHECK
          The most thorough argument checking level; use only for debugging.
static double INFINITY
          The number used to represent an infinite numeric value; the negative of this number represents negative infinity.
static int NAME_MAX
          The maximum length of any name of a Netica item (Node, Net, state, ...).
static int NO_CHECK
          Turns off all argument checking.
static int QUICK_CHECK
          Only does argument checking that can be done very quickly.
static int REGULAR_CHECK
          Does argument checking suitable for software development, and final releases of your software where speed is not significant.
static double UNDEF_DBL
          The number used to represent unknown or nonexistent numeric values.
 
Constructor Summary
Environ(java.lang.String license)
          Constructs an initialized Netica environment.
 
Method Summary
 void finalize()
          Closes down Netica and frees all its resources (e.g., memory).
 int getArgumentChecking()
          Returns the current argument checking level, which is the degree to which Netica checks function call arguments.
 char getCaseFileDelimChar()
          Gets the character to use as a delimeter when creating case files.
static Environ getDefaultEnviron()
          Returns the last created Environ.
 char getMissingDataChar()
          Gets the character used to indicate missing data when creating case files.
 int getVersion()
          Returns the version number of Netica, multiplied by 100.
 java.lang.String getVersionString()
          Returns a String consisting of the full version number, a space, a code for the type of machine or OS it is running on, a comma, the name of the program, and finally a code indicating some build information (in parentheses).
 void setArgumentChecking(int setting)
          Set the level of argument checking (one of NO_CHECK, QUICK_CHECK, REGULAR_CHECK, COMPLETE_CHECK).
 void setCaseFileDelimChar(char newChar)
          Sets the symbol used to separate data fields in a case file being created by Netica.
 void setMissingDataChar(char newChar)
          Sets the symbol to be used for indicating missing data fields in a case file created by Netica (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_MAX

public static final int NAME_MAX
The maximum length of any name of a Netica item (Node, Net, state, ...). Currently set at 30 and not likely to change.


NO_CHECK

public static final int NO_CHECK
Turns off all argument checking. Final release versions of your software should use QUICK_CHECK instead.

See Also:
setArgumentChecking  


QUICK_CHECK

public static final int QUICK_CHECK
Only does argument checking that can be done very quickly. Suitable for final release versions of your software.

See Also:
setArgumentChecking  


REGULAR_CHECK

public static final int REGULAR_CHECK
Does argument checking suitable for software development, and final releases of your software where speed is not significant.

See Also:
setArgumentChecking  


COMPLETE_CHECK

public static final int COMPLETE_CHECK
The most thorough argument checking level; use only for debugging. May be very slow.

See Also:
setArgumentChecking  


UNDEF_DBL

public static double UNDEF_DBL
The number used to represent unknown or nonexistent numeric values.


INFINITY

public static double INFINITY
The number used to represent an infinite numeric value; the negative of this number represents negative infinity.

Constructor Detail

Environ

public Environ(java.lang.String license)
        throws NeticaException
Constructs an initialized Netica environment. The Environ constructed becomes the "default" environment. Net and Streamer objects are always constructed within the current default environment.

For license pass the license string provided to you when you purchased Netica, or null if you don't have one. The behavior of the Netica system may be limited by the license you use.

Currently it is possible to have only one global environment which can be accessed by calling the static method getDefaultEnviron.

Parameters:
license - The license string provided to you when you purchased Netica, or null if you don't have one.
Method Detail

getDefaultEnviron

public static Environ getDefaultEnviron()
Returns the last created Environ. The last created Environ is known as the "default Environ". It is used by several constructors, as a convenience.

Version:
This function is available in all versions.
See Also:
Streamer(String)  Constructs a Streamer in the default Environ.
Net()  Constructs a Net in the default Environ.


finalize

public void finalize()
              throws NeticaException
Closes down Netica and frees all its resources (e.g., memory).

After calling this, the contents of this Environ are invalid and should not be used.

No data structure that was returned by any Netica API function will have valid contents after calling finalize.

Netica may be stopped (with finalize) and then later restarted (with new Environ), but no data structures created by one session may be used by another.

In a multi-threaded environment, ensure that only one thread calls finalize, and after that, no threads may use any Netica function.

If you override this method, be sure to call the base class method (super.finalize();).

Version:

This function is available in all versions.
In the C Version of the API, this function is called CloseNetica_bn.
See Also:
Environ  Creates the norsys.netica.Environ

Overrides:
finalize in class java.lang.Object

getVersion

public int getVersion()
               throws NeticaException
Returns the version number of Netica, multiplied by 100. For example, if the version of Netica currently running is 1.21, then 121 is returned.

Version:
This function is available in all versions.
In the C Version of the API, this function is called GetNeticaVersion_bn.
Example:
  int ver = Environ.getDefaultEnviron().getVersion();
  System.out.println ("The version number of Netica-J is " + (ver / 100.0));

getVersionString

public java.lang.String getVersionString()
                                  throws NeticaException
Returns a String consisting of the full version number, a space, a code for the type of machine or OS it is running on, a comma, the name of the program, and finally a code indicating some build information (in parentheses). An example is:    2.06 Win, Netica-J (AB).

Version:
This function is available in all versions.
In the C Version of the API, this function is called GetNeticaVersion_bn.
Example:
  System.out.println ("Version of Netica-J running: " +
                      Environ.getDefaultEnviron().getVersionString());

getArgumentChecking

public int getArgumentChecking()
                        throws NeticaException
Returns the current argument checking level, which is the degree to which Netica checks function call arguments.

Version:
This function is available in all versions.
In the C Version of the API, this function is called ArgumentChecking_ns.
See Also:
setArgumentChecking  


setArgumentChecking

public void setArgumentChecking(int setting)
                         throws NeticaException
Set the level of argument checking (one of NO_CHECK, QUICK_CHECK, REGULAR_CHECK, COMPLETE_CHECK).

Whenever a Netica API function is called, its arguments may be automatically checked for validity. Call this function anytime to adjust the degree of checking Netica does until it is called next.

setting should be one of:
NO_CHECK  No checking
QUICK_CHECK  Only checks things that can be checked very quickly
REGULAR_CHECK  Regular checking
COMPLETE_CHECK  Exhaustively checks everything.
Normally during development, the REGULAR_CHECK setting is used. For debugging, the setting can temporarily be changed to COMPLETE_CHECK, but that will run too slowly for most regular development. Once development is complete, production versions would normally have a setting of QUICK_CHECK ( NO_CHECK is discouraged, since it isn't much faster, but its also a possibility), but they may occasionally temporarily change it to REGULAR_CHECK in order to do user input checking.

The previous degree of checking is returned.

Version:

This function is available in all versions.
In the C Version of the API, this function is called ArgumentChecking_ns.
See Also:
getArgumentChecking

Parameters:
setting - The new level of argument checking desired.

getCaseFileDelimChar

public char getCaseFileDelimChar()
                          throws NeticaException
Gets the character to use as a delimeter when creating case files.

Version:
This function is available in all versions.
In the C Version of the API, this function is called SetCaseFileDelimChar_ns.
See Also:
setCaseFileDelimChar  

Example:

setCaseFileDelimChar

public void setCaseFileDelimChar(char newChar)
                          throws NeticaException
Sets the symbol used to separate data fields in a case file being created by Netica.

For newchar, pass one of tab ('\t'), space (' ') or comma (',').

Whole cases are always separated by a line end (i.e. a carriage return, a newline, or both).

newchar will only be used by Netica for creating case files; while reading them it will understand any of the above choices.

Version:

Versions 1.18 and later have this function.
In the C Version of the API, this function is called SetCaseFileDelimChar_ns.
See Also:
setMissingDataChar  Set the character used to indicate missing data
writeCase  The function that uses the file delimiter character
getCaseFileDelimChar  (inverse function) Get the current character used for this purpose

Example:
  Environ env = getDefaultEnviron();
  char oldDelim = env.getCaseFileDelimChar();
  char oldMiss  = env.getMissingDataChar();
  env.setCaseFileDelimChar (',');
  env.setMissingDataChar ((char) 0);    // 0 allowed only if delim char is comma
  // ... write the case to file ...
  env.setCaseFileDelimChar (oldDelim);  // restore (if desired)
  env.setMissingDataChar (oldMiss);
Parameters:
newchar - The new character to be used.

getMissingDataChar

public char getMissingDataChar()
                        throws NeticaException
Gets the character used to indicate missing data when creating case files.

Version:
This function is available in all versions.
In the C Version of the API, this function is called SetMissingDataChar_ns.

setMissingDataChar

public void setMissingDataChar(char newChar)
                        throws NeticaException
Sets the symbol to be used for indicating missing data fields in a case file created by Netica (i.e. when Netica has to provide the value for a node, and that node doesn't have a finding entered).

For newchar, pass one of asterisk ('*'), question mark ('?'), space (' '), or absent ( (char) 0 ). It cannot be space or absent unless the delimiter symbol is a comma (see  setCaseFileDelimChar).

newchar will only be used by Netica for creating case files; while reading them it will understand any of the above choices.

Version:

Versions 1.18 and later have this function.
In the C Version of the API, this function is called SetMissingDataChar_ns.
See Also:
setCaseFileDelimChar  Set the character used to separate data entries
writeCase  The function that uses the missing data character
getMissingDataChar  (inverse function) Get the current character used for this purpose

Example:
Parameters:
newchar - The new character to be used.