com.cra.bnet.io
Class NeticaFormat

java.lang.Object
  |
  +--com.cra.bnet.io.AbstractBnetFormat
        |
        +--com.cra.bnet.io.NeticaFormat
All Implemented Interfaces:
BnetFormat

public class NeticaFormat
extends AbstractBnetFormat

Reads and writes Bayesian networks in Netica format.


Constructor Summary
NeticaFormat()
           
 
Method Summary
 String getDescription()
          Returns a short description of the Netica format.
 String getExtension()
          Returns the Netica file extension, ie the string "dne".
 boolean isValid(BufferedRegExpReader reader)
          Returns false because this method has not yet been implemented.
static BayesianNetwork read(File file)
          Returns the Bayesian network read from the specified file.
 BayesianNetwork read(Reader reader)
          Returns the Bayesian network obtained from the specified reader.
static boolean write(BayesianNetwork network, File file)
          Writes the specified Bayesian network to the specified file.
 boolean write(BayesianNetwork network, Writer writer)
          Writes the specified Bayesian network to the specified writer in Netica format and returns true if the Bayesian network was written successfully.
 
Methods inherited from class com.cra.bnet.io.AbstractBnetFormat
getError, setError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeticaFormat

public NeticaFormat()
Method Detail

read

public static BayesianNetwork read(File file)
Returns the Bayesian network read from the specified file.

Parameters:
file - file containing a Bayesian network in Netica format.
Returns:
the Bayesian network read from the specified file.
Throws:
NullPointerException - if the specified file is null.
IllegalArgumentException - if file.exists() returns false.

write

public static boolean write(BayesianNetwork network,
                            File file)
Writes the specified Bayesian network to the specified file.

Parameters:
network - Bayesian network to write.
file - file to write to.
Returns:
true if the Bayesian network was written correctly.
Throws:
NullPointerException - if the specified network or file is null.

getDescription

public String getDescription()
Returns a short description of the Netica format.

Returns:
a short description of the Netica format.

getExtension

public String getExtension()
Returns the Netica file extension, ie the string "dne".

Returns:
the Netica file extension, ie the string "dne".

isValid

public boolean isValid(BufferedRegExpReader reader)
Returns false because this method has not yet been implemented.

Parameters:
reader -
Returns:
false because this method has not yet been implemented.

read

public BayesianNetwork read(Reader reader)
Returns the Bayesian network obtained from the specified reader.

Parameters:
reader - input stream that provides a Bayesian network in Netica format.
Returns:
the Bayesian network obtained from the specified reader.

write

public boolean write(BayesianNetwork network,
                     Writer writer)
Writes the specified Bayesian network to the specified writer in Netica format and returns true if the Bayesian network was written successfully.

Parameters:
network - Bayesian network to write.
writer - output stream to write to.
Returns:
true if the Bayesian network was written successfully.