KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > susebox > jtopas > spi > DataMapper


1 /*
2  * DataMapper.java: service provider interface for data-to-token mapping.
3  *
4  * Copyright (C) 2002 Heiko Blau
5  *
6  * This file belongs to the JTopas Library.
7  * JTopas is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or (at your
10  * option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License along
18  * with JTopas. If not, write to the
19  *
20  * Free Software Foundation, Inc.
21  * 59 Temple Place, Suite 330,
22  * Boston, MA 02111-1307
23  * USA
24  *
25  * or check the Internet: http://www.fsf.org
26  *
27  * Contact:
28  * email: heiko@susebox.de
29  */

30
31 package de.susebox.jtopas.spi;
32
33 //-----------------------------------------------------------------------------
34
// Imports
35
//
36
import de.susebox.jtopas.TokenizerProperties;
37
38
39 //-----------------------------------------------------------------------------
40
// Interface DataMapper
41
//
42

43 /**<p>
44  * This interface declares the methods that a {@link de.susebox.jtopas.Tokenizer}
45  * will call to detect the image and type of a token. Usually, an implementation
46  * of the {@link de.susebox.jtopas.TokenizerProperties} interface should also
47  * implement the <code>DataMapper</code> interface, but this is not mandatory.
48  *</p><p>
49  * If a {@link de.susebox.jtopas.TokenizerProperties} instance given to a
50  * {@link de.susebox.jtopas.Tokenizer} does not implement the <code>DataMapper</code>
51  * interface, then the <code>Tokenizer</code> will contruct a default <code>DataMapper</code>
52  * for its properties.
53  *</p><p>
54  * This interface extends the SPI interfaces specialized in handling various token
55  * types.
56  *</p>
57  *
58  * @see de.susebox.jtopas.Tokenizer
59  * @see de.susebox.jtopas.TokenizerProperties
60  * @author Heiko Blau
61  */

62 public interface DataMapper
63   extends WhitespaceHandler, SeparatorHandler, KeywordHandler, SequenceHandler, PatternHandler
64 {
65   
66   /**
67    * Setting the backing {@link de.susebox.jtopas.TokenizerProperties} instance
68    * this <code>DataMapper</code> is working with. Usually, the <code>DataMapper</code>
69    * interface is implemented by <code>TokenizerProperties</code> implementations,
70    * too. Otherwise the {@link de.susebox.jtopas.Tokenizer} using the
71    * <code>TokenizerProperties</code>, will construct a default <code>DataMapper</code>
72    * an propagate the <code>TokenizerProperties</code> instance by calling this
73    * method.
74    *<br>
75    * The method should throw an {@link java.lang.UnsupportedOperationException}
76    * if this <code>DataMapper</code> is an extension to an <code>TokenizerProperties</code>
77    * implementation.
78    *
79    * @param props the {@link de.susebox.jtopas.TokenizerProperties}
80    * @throws UnsupportedOperationException is this is a <code>DataMapper</code>
81    * implemented by a {@link de.susebox.jtopas.TokenizerProperties}
82    * implementation
83    * @throws NullPointerException if no {@link TokenizerProperties} are given
84    */

85   public void setTokenizerProperties(TokenizerProperties props)
86     throws UnsupportedOperationException JavaDoc, NullPointerException JavaDoc;
87
88   /**
89    * The method retrieves the backing {@link de.susebox.jtopas.TokenizerProperties}
90    * instance, this <code>DataMapper</code> is working on. For implementations
91    * of the <code>TokenizerProperties</code> interface that also implement the
92    * <code>DataMapper</code> interface, this method returns the instance itself.
93    *<br>
94    * Otherwise the method returns the <code>TokenizerProperties</code> instance
95    * passed through the last call to {@link #setTokenizerProperties} or <code>null</code>
96    * if no such call has taken place so far.
97    *
98    * @return the backing {@link de.susebox.jtopas.TokenizerProperties} or <code>null</code>
99    */

100   public TokenizerProperties getTokenizerProperties();
101 }
102
Popular Tags