1 //$Id: Record.java,v 1.12 2006/08/04 12:25:57 bpeters Exp $
\r
3 * Copyright (C) 2004 Bas Peters
\r
5 * This file is part of MARC4J
\r
7 * MARC4J is free software; you can redistribute it and/or
\r
8 * modify it under the terms of the GNU Lesser General Public
\r
9 * License as published by the Free Software Foundation; either
\r
10 * version 2.1 of the License, or (at your option) any later version.
\r
12 * MARC4J is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
15 * Lesser General Public License for more details.
\r
17 * You should have received a copy of the GNU Lesser General Public
\r
18 * License along with MARC4J; if not, write to the Free Software
\r
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
21 package org.marc4j.marc;
\r
23 import java.io.Serializable;
\r
24 import java.util.List;
\r
26 import org.marc4j.marc.Leader;
\r
29 * Represents a MARC record.
\r
31 * @author Bas Peters
\r
32 * @version $Revision: 1.12 $
\r
34 public interface Record extends Serializable {
\r
37 * Sets the identifier.
\r
40 * The purpose of this identifier is to provide an identifier for
\r
43 * @param id the identifier
\r
45 public void setId(Long id);
\r
48 * Returns the identifier.
\r
50 * @return Long - the identifier
\r
52 public Long getId();
\r
55 * Sets the type of record.
\r
58 * the type of record
\r
60 public void setType(String type);
\r
63 * Returns the type of record.
\r
65 * @return String - the type of record
\r
67 public String getType();
\r
70 * Adds a <code>VariableField</code>.
\r
73 * the <code>VariableField</code>
\r
74 * @throws IllegalAddException
\r
75 * when the parameter is not a <code>VariableField</code>
\r
78 public void addVariableField(VariableField field);
\r
81 * Removes a variable field from the collection.
\r
84 * the variable field
\r
86 public void removeVariableField(VariableField field);
\r
89 * Returns a list of variable fields
\r
91 * @return List - the variable fields
\r
93 public List getVariableFields();
\r
96 * Returns a list of control fields
\r
98 * @return List - the control fields
\r
100 public List getControlFields();
\r
103 * Returns a list of data fields
\r
105 * @return List - the data fields
\r
107 public List getDataFields();
\r
110 * Returns the control number field or <code>null</code> if no control
\r
111 * number field is available.
\r
113 * @return ControlField - the control number field
\r
115 public ControlField getControlNumberField();
\r
118 * Returns the control number or <code>null</code> if no control number is
\r
121 * This method returns the data for a <code>ControlField</code> with tag
\r
124 * @return String - the control number
\r
126 public String getControlNumber();
\r
129 * Returns the first instance of the variable field with the given tag.
\r
131 * @return VariableField - the variable field
\r
133 public VariableField getVariableField(String tag);
\r
136 * Returns a list of variable fields with the given tag.
\r
138 * @return List - the variable fields
\r
140 public List getVariableFields(String tag);
\r
143 * Returns a list of variable fields for the given tags.
\r
149 * String tags = { "100", "245", "260", "300" };
\r
151 * List fields = record.getVariableFields(tags);
\r
154 * @return List - the variable fields
\r
156 public List getVariableFields(String[] tag);
\r
159 * Returns the <code>Leader</code>.
\r
161 * @return Leader - the <code>Leader</code>
\r
163 public Leader getLeader();
\r
166 * Sets the <code>Leader</code>.
\r
169 * the <code>Leader</code>
\r
171 public void setLeader(Leader leader);
\r
174 * Returns a List of VariableField objects that have a data element that
\r
175 * matches the given regular expression.
\r
178 * See {@link java.util.regex.Pattern} for more information about Java
\r
179 * regular expressions.
\r
183 * the regular expression
\r
184 * @return List - the result list
\r
186 public List find(String pattern);
\r
189 * Returns a List of VariableField objects with the given tag that have a
\r
190 * data element that matches the given regular expression.
\r
193 * See {@link java.util.regex.Pattern} for more information about Java
\r
194 * regular expressions.
\r
200 * the regular expression
\r
201 * @return List - the result list
\r
203 public List find(String tag, String pattern);
\r
206 * Returns a List of VariableField objects with the given tags that have a
\r
207 * data element that matches the given regular expression.
\r
210 * See {@link java.util.regex.Pattern} for more information about Java
\r
211 * regular expressions.
\r
217 * the regular expression
\r
218 * @return List - the result list
\r
220 public List find(String[] tag, String pattern);
\r