/************************************************************************ * * ConverterResultImpl.java * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * Copyright: 2002-2010 by Henrik Just * * All Rights Reserved. * * Version 1.2 (2010-03-22) * */ package writer2latex.base; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Vector; import java.util.Iterator; import writer2latex.api.ConverterResult; import writer2latex.api.MetaData; import writer2latex.api.OutputFile; /** *
ConvertData
is used as a container for passing
* OutputFile
objects in and out of the Convert
* class. The ConvertData
contains a String
* name and a Vector
of OutputFile
objects.
OutputFile
objects.
*/
private VectorConvertData
object.
*/
private String name;
private MetaData metaData = null;
/**
* Resets ConvertData. This empties all OutputFile
* objects from this class. This allows reuse of a
* ConvertData
.
*/
public void reset() {
name = null;
v.removeAllElements();
}
/**
* Returns the OutputFile
name.
*
* @return The OutputFile
name.
*/
public String getName() {
return name;
}
/**
* Sets the OutputFile
name.
*
* @param docName The name of the OutputFile
.
*/
public void setName(String docName) {
name = docName;
}
/**
* Adds a OutputFile
to the vector.
*
* @param doc The OutputFile
to add.
*/
public void addDocument(OutputFile doc) {
if (v.size()==0) { masterDoc = doc; }
v.add(doc);
}
/** Get the master document
* @return OutputFile
the master document
*/
public OutputFile getMasterDocument() {
return masterDoc;
}
/** Check if a given document is the master document
* @param doc The OutputFile
to check
* @return true if this is the master document
*/
public boolean isMasterDocument(OutputFile doc) {
return doc == masterDoc;
}
/**
* Gets an Iterator
to access the Vector
* of OutputFile
objects
*
* @return The Iterator
to access the
* Vector
of OutputFile
objects.
*/
public IteratorOutputFile
objects currently stored
*
* @return The number of OutputFile
objects currently
* stored.
*/
public int getNumDocuments() {
return (v.size());
}
public void write(File dir) throws IOException {
if (dir!=null && !dir.exists()) throw new IOException("Directory does not exist");
Iterator