unbbayes.io
Class XMLBIFIO

java.lang.Object
  extended by unbbayes.io.XMLBIFIO
All Implemented Interfaces:
BaseIO

public class XMLBIFIO
extends Object
implements BaseIO

Manipulates I/O of XMLBIF file format.

Version:
3.1, 02/14/2010 - Moved MSBN-specific routines into XMLBIFMSBNIO
Author:
Rommel Carvalho (rommel.carvalho@gmail.com), Laecio Lima dos Santos (laecio@gmail.com) (version 2.0), Shigeki (version 1.0), Shou Matsumoto (version 3.1)

Field Summary
static String[] SUPPORTED_EXTENSIONS
          Supported file extension with no dots.
 
Constructor Summary
XMLBIFIO()
           
 
Method Summary
 String getName()
          Gets the name of this I/O component.
 String[] getSupportedFileExtensions(boolean isLoadOnly)
          Obtains an array of file extensions supported by this network window.
 String getSupportedFilesDescription(boolean isLoadOnly)
          Gets a description of supported file extensions, which may be shown to the user through file chooser's file filter to explain what file format are supported.
 ProbabilisticNetwork load(File input)
          Loads a new Probabilistic network from the input file.
 void save(File output, Graph graph)
          Saves a network to the output file.
 void setName(String name)
          Sets the name of this I/O component.
 boolean supports(File file, boolean isLoadOnly)
          Returns true if the file is supported by this IO class.
 boolean supports(String extension, boolean isLoadOnly)
          Checks if file extension is compatible to what this i/o expects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_EXTENSIONS

public static final String[] SUPPORTED_EXTENSIONS
Supported file extension with no dots. The value is {"xml"}

Constructor Detail

XMLBIFIO

public XMLBIFIO()
Method Detail

load

public ProbabilisticNetwork load(File input)
                          throws LoadException,
                                 IOException
Loads a new Probabilistic network from the input file.

Specified by:
load in interface BaseIO
Parameters:
input - the input file for the network
Returns:
The loaded network
Throws:
LoadException - If the file doesn't describes a network.
IOException - If an IO error occurs

save

public void save(File output,
                 Graph graph)
          throws IOException
Saves a network to the output file.

Specified by:
save in interface BaseIO
Parameters:
output - The output file to save
graph - The network to save.
Throws:
IOException

supports

public boolean supports(String extension,
                        boolean isLoadOnly)
Checks if file extension is compatible to what this i/o expects.

Parameters:
extension -
isLoadOnly -
Returns:
See Also:
supports(File, boolean)

getSupportedFileExtensions

public String[] getSupportedFileExtensions(boolean isLoadOnly)
Description copied from interface: BaseIO
Obtains an array of file extensions supported by this network window. The file extensions should come without the dot

Specified by:
getSupportedFileExtensions in interface BaseIO
Parameters:
isLoadOnly - : if set to true, it should consider file extensions for file loading (input). If set to false, it should consider both saving and loading. Note that not every module/plugin can implement both loading and saving, and this parameter may separate such special behaviors.
Returns:

getSupportedFilesDescription

public String getSupportedFilesDescription(boolean isLoadOnly)
Description copied from interface: BaseIO
Gets a description of supported file extensions, which may be shown to the user through file chooser's file filter to explain what file format are supported. E.g. "Net (.net), XMLBIF(.xml), UnBBayes File (.ubf)"

Specified by:
getSupportedFilesDescription in interface BaseIO
Parameters:
isLoadOnly - : if set to true, it should consider file extensions for file loading (input). If set to false, it should consider both saving and loading. Note that not every module/plugin can implement both loading and saving, and this parameter may separate such special behaviors.

supports

public boolean supports(File file,
                        boolean isLoadOnly)
Description copied from interface: BaseIO
Returns true if the file is supported by this IO class. It may be implemented as simple extension check. False otherwise.

Specified by:
supports in interface BaseIO
Parameters:
file - : the file to analyze extension.
isLoadOnly - : if set to true, it should consider file extensions for file loading (input). If set to false, it should consider both saving and loading. Note that not every I/O class can implement both loading and saving, and this parameter may separate such special behaviors.
Returns:

getName

public String getName()
Description copied from interface: BaseIO
Gets the name of this I/O component. This name may be displayed to a user when there is a need to choose a specific I/O class to use.

Specified by:
getName in interface BaseIO
Returns:
the name

setName

public void setName(String name)
Description copied from interface: BaseIO
Sets the name of this I/O component. This name may be displayed to a user when there is a need to choose a specific I/O class to use.

Specified by:
setName in interface BaseIO
Parameters:
name - the name to set


Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.