]> git.somenet.org - irc/pjirc-ng.git/blob - src/main/java/irc/style/DrawResultItem.java
Pjirc 2.2.1 as available on the net, reformatted and made it compile.
[irc/pjirc-ng.git] / src / main / java / irc / style / DrawResultItem.java
1 /*****************************************************/\r
2 /*          This java file is a part of the          */\r
3 /*                                                   */\r
4 /*           -  Plouf's Java IRC Client  -           */\r
5 /*                                                   */\r
6 /*   Copyright (C)  2002 - 2004 Philippe Detournay   */\r
7 /*                                                   */\r
8 /*         All contacts : theplouf@yahoo.com         */\r
9 /*                                                   */\r
10 /*  PJIRC is free software; you can redistribute     */\r
11 /*  it and/or modify it under the terms of the GNU   */\r
12 /*  General Public License as published by the       */\r
13 /*  Free Software Foundation; version 2 or later of  */\r
14 /*  the License.                                     */\r
15 /*                                                   */\r
16 /*  PJIRC is distributed in the hope that it will    */\r
17 /*  be useful, but WITHOUT ANY WARRANTY; without     */\r
18 /*  even the implied warranty of MERCHANTABILITY or  */\r
19 /*  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   */\r
20 /*  General Public License for more details.         */\r
21 /*                                                   */\r
22 /*  You should have received a copy of the GNU       */\r
23 /*  General Public License along with PJIRC; if      */\r
24 /*  not, write to the Free Software Foundation,      */\r
25 /*  Inc., 59 Temple Place, Suite 330, Boston,        */\r
26 /*  MA  02111-1307  USA                              */\r
27 /*                                                   */\r
28 /*****************************************************/\r
29 \r
30 package irc.style;\r
31 \r
32 /**\r
33  * A recognized item.\r
34  */\r
35 public class DrawResultItem {\r
36         /**\r
37          * The item rectangle on display, relative to its parent.\r
38          */\r
39         public StyledRectangle rectangle;\r
40         /**\r
41          * The item content. This content is the trimmed version of the stripped\r
42          * content. Characters like parenthesis and braces are also trimmed. For\r
43          * instance, "(text)" gives "text" in the itemized version. Item is used for\r
44          * word recognition.\r
45          */\r
46         public String item;\r
47         /**\r
48          * The original word content.\r
49          */\r
50         public String originalword;\r
51         /**\r
52          * The original word content, but stripped from all special codes.\r
53          */\r
54         public String originalstrippedword;\r
55         /**\r
56          * The parent DrawResult.\r
57          */\r
58         public DrawResult parent;\r
59 \r
60         @Override\r
61         public boolean equals(Object o) {\r
62                 if (!(o instanceof DrawResultItem))\r
63                         return false;\r
64                 DrawResultItem i = (DrawResultItem) o;\r
65                 return i.rectangle.equals(rectangle) && i.originalword.equals(originalword)\r
66                                 && i.parent.rectangle.equals(parent.rectangle);\r
67         }\r
68 \r
69         @Override\r
70         public int hashCode() {\r
71                 return rectangle.hashCode() + originalword.hashCode();\r
72         }\r
73 \r
74         @Override\r
75         public String toString() {\r
76                 return item + " at " + rectangle + " with parent at " + parent.rectangle;\r
77         }\r
78 }\r