1 |
/************************************************************************************************* |
2 |
* Java interface of Hyper Estraier |
3 |
* Copyright (C) 2004-2005 Mikio Hirabayashi |
4 |
* All rights reserved. |
5 |
* This file is part of Hyper Estraier. |
6 |
* Redistribution and use in source and binary forms, with or without modification, are |
7 |
* permitted provided that the following conditions are met: |
8 |
* |
9 |
* * Redistributions of source code must retain the above copyright notice, this list of |
10 |
* conditions and the following disclaimer. |
11 |
* * Redistributions in binary form must reproduce the above copyright notice, this list of |
12 |
* conditions and the following disclaimer in the documentation and/or other materials |
13 |
* provided with the distribution. |
14 |
* * Neither the name of Mikio Hirabayashi nor the names of its contributors may be used to |
15 |
* endorse or promote products derived from this software without specific prior written |
16 |
* permission. |
17 |
* |
18 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
19 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
20 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
21 |
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
22 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
23 |
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
25 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
26 |
* OF THE POSSIBILITY OF SUCH DAMAGE. |
27 |
*************************************************************************************************/ |
28 |
|
29 |
|
30 |
package estraier; |
31 |
|
32 |
|
33 |
|
34 |
/** |
35 |
* Abstraction of document. |
36 |
*/ |
37 |
public interface Document { |
38 |
//---------------------------------------------------------------- |
39 |
// public methods |
40 |
//---------------------------------------------------------------- |
41 |
/** |
42 |
* Add an attribute. |
43 |
* @param name the name of an attribute. |
44 |
* @param value the value of the attribute. If it is null, the attribute is removed. |
45 |
*/ |
46 |
void add_attr(String name, String value); |
47 |
/** |
48 |
* Add a sentence of text. |
49 |
* @param text sentence of text. |
50 |
*/ |
51 |
void add_text(String text); |
52 |
/** |
53 |
* Add a hidden sentence. |
54 |
* @param text a hidden sentence. |
55 |
*/ |
56 |
void add_hidden_text(String text); |
57 |
/** |
58 |
* Get the ID number. |
59 |
* @return the ID number. If this object has never been registered, -1 is returned. |
60 |
*/ |
61 |
int id(); |
62 |
/** |
63 |
* Get a list of attribute names. |
64 |
* @return a list of attribute names. |
65 |
*/ |
66 |
java.util.List attr_names(); |
67 |
/** |
68 |
* Get the value of an attribute. |
69 |
* @param name the name of an attribute. |
70 |
* @return the value of the attribute or null if it does not exist. |
71 |
*/ |
72 |
String attr(String name); |
73 |
/** |
74 |
* Get a list of sentences of the text. |
75 |
* @return a list object of sentences of the text. |
76 |
*/ |
77 |
java.util.List texts(); |
78 |
/** |
79 |
* Concatenate sentences of the text. |
80 |
* @return concatenated sentences of a document object. |
81 |
*/ |
82 |
String cat_texts(); |
83 |
/** |
84 |
* Dump draft data. |
85 |
* @return draft data. |
86 |
*/ |
87 |
String dump_draft(); |
88 |
/** |
89 |
* Make a snippet of the body text. |
90 |
* @param words a list object of words to be highlight. |
91 |
* @param wwidth whole width of the result. |
92 |
* @param hwidth width of strings picked up from the beginning of the text. |
93 |
* @param awidth width of strings picked up around each highlighted word. |
94 |
* @return a snippet string of the body text. |
95 |
*/ |
96 |
String make_snippet(java.util.List words, int wwidth, int hwidth, int awidth); |
97 |
/** |
98 |
* Check whether the text includes every specified words. |
99 |
* @param words a list object of words to be checked. |
100 |
* @return true if every specified words is found, else it is false. |
101 |
*/ |
102 |
boolean scan_words(java.util.List words); |
103 |
} |
104 |
|
105 |
|
106 |
|
107 |
/* END OF FILE */ |