1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.xmerge; 25 26 import java.util.Vector; 27 import java.util.Enumeration; 28 29 /** 30 * <p><code>ConvertData</code> is used as a container for passing 31 * <code>Document</code> objects in and out of the <code>Convert</code> 32 * class. The <code>ConvertData</code> contains a <code>String</code> 33 * name and a <code>Vector</code> of <code>Document</code> objects.</p> 34 * 35 * @author Martin Maher 36 */ 37 public class ConvertData { 38 39 /** 40 * Vector of <code>Document</code> objects. 41 */ 42 private Vector v = new Vector(); 43 44 /** 45 * Name of the <code>ConvertData</code> object. 46 */ 47 private String name; 48 49 50 /** 51 * Resets ConvertData. This empties all <code>Document</code> 52 * objects from this class. This allows reuse of a 53 * <code>ConvertData</code>. 54 */ reset()55 public void reset() { 56 name = null; 57 v.removeAllElements(); 58 } 59 60 /** 61 * Returns the <code>Document</code> name. 62 * 63 * @return The <code>Document</code> name. 64 */ getName()65 public String getName() { 66 return name; 67 } 68 69 70 /** 71 * Sets the <code>Document</code> name. 72 * 73 * @param docName The name of the <code>Document</code>. 74 */ setName(String docName)75 public void setName(String docName) { 76 name = docName; 77 } 78 79 80 /** 81 * Adds a <code>Document</code> to the vector. 82 * 83 * @param doc The <code>Document</code> to add. 84 */ addDocument(Document doc)85 public void addDocument(Document doc) { 86 v.add(doc); 87 } 88 89 90 /** 91 * Gets an <code>Enumeration</code> to access the <code>Vector</code> 92 * of <code>Document</code> objects. 93 * 94 * @return The <code>Enumeration</code> to access the 95 * <code>Vector</code> of <code>Document</code> objects. 96 */ getDocumentEnumeration()97 public Enumeration getDocumentEnumeration() { 98 Enumeration enumerate = v.elements(); 99 return (enumerate); 100 } 101 102 103 /** 104 * Gets the number of <code>Document</code> objects currently stored 105 * 106 * @return The number of <code>Document</code> objects currently 107 * stored. 108 */ getNumDocuments()109 public int getNumDocuments() { 110 return (v.size()); 111 } 112 } 113 114