unbbayes.io
Interface BaseIO

All Known Implementing Classes:
DneIO, FileExtensionIODelegator, NetIO, OwnerAwareFileExtensionIODelegator, PluginAwareFileExtensionIODelegator, XMLBIFIO

public interface BaseIO

This is the most basic I/O interface for UnBBayes, which basically loads or stores a Graph from/into a file.

Version:
2.0
Author:
Rommel N. Carvalho, Michael S. Onishi, Shou Matsumoto

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.
 Graph load(File input)
          Loads a new network from the input file.
 void save(File output, Graph net)
          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.
 

Method Detail

load

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

Parameters:
input - the input file for the network
Returns:
The loaded network
Throws:
LoadException - If the file doesn't describe a network.
IOException - If an IO error occurs

save

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

Parameters:
output - The output file to save
net - The network to save.
Throws:
IOException

supports

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

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:

getSupportedFileExtensions

String[] getSupportedFileExtensions(boolean isLoadOnly)
Obtains an array of file extensions supported by this network window. The file extensions should come without the dot

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

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. E.g. "Net (.net), XMLBIF(.xml), UnBBayes File (.ubf)"

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.

setName

void setName(String name)
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.

Parameters:
name -

getName

String getName()
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.

Returns:
a name


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