|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Attribute.java | - | 80% | 75% | 77.8% |
|
1 | /* | |
2 | * Java HTML Tidy - JTidy | |
3 | * HTML parser and pretty printer | |
4 | * | |
5 | * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts | |
6 | * Institute of Technology, Institut National de Recherche en | |
7 | * Informatique et en Automatique, Keio University). All Rights | |
8 | * Reserved. | |
9 | * | |
10 | * Contributing Author(s): | |
11 | * | |
12 | * Dave Raggett <dsr@w3.org> | |
13 | * Andy Quick <ac.quick@sympatico.ca> (translation to Java) | |
14 | * Gary L Peskin <garyp@firstech.com> (Java development) | |
15 | * Sami Lempinen <sami@lempinen.net> (release management) | |
16 | * Fabrizio Giustina <fgiust at users.sourceforge.net> | |
17 | * | |
18 | * The contributing author(s) would like to thank all those who | |
19 | * helped with testing, bug fixes, and patience. This wouldn't | |
20 | * have been possible without all of you. | |
21 | * | |
22 | * COPYRIGHT NOTICE: | |
23 | * | |
24 | * This software and documentation is provided "as is," and | |
25 | * the copyright holders and contributing author(s) make no | |
26 | * representations or warranties, express or implied, including | |
27 | * but not limited to, warranties of merchantability or fitness | |
28 | * for any particular purpose or that the use of the software or | |
29 | * documentation will not infringe any third party patents, | |
30 | * copyrights, trademarks or other rights. | |
31 | * | |
32 | * The copyright holders and contributing author(s) will not be | |
33 | * liable for any direct, indirect, special or consequential damages | |
34 | * arising out of any use of the software or documentation, even if | |
35 | * advised of the possibility of such damage. | |
36 | * | |
37 | * Permission is hereby granted to use, copy, modify, and distribute | |
38 | * this source code, or portions hereof, documentation and executables, | |
39 | * for any purpose, without fee, subject to the following restrictions: | |
40 | * | |
41 | * 1. The origin of this source code must not be misrepresented. | |
42 | * 2. Altered versions must be plainly marked as such and must | |
43 | * not be misrepresented as being the original source. | |
44 | * 3. This Copyright notice may not be removed or altered from any | |
45 | * source or altered source distribution. | |
46 | * | |
47 | * The copyright holders and contributing author(s) specifically | |
48 | * permit, without fee, and encourage the use of this source code | |
49 | * as a component for supporting the Hypertext Markup Language in | |
50 | * commercial products. If you use this source code in a product, | |
51 | * acknowledgment is not required but would be appreciated. | |
52 | * | |
53 | */ | |
54 | package org.w3c.tidy; | |
55 | ||
56 | /** | |
57 | * HTML attribute. | |
58 | * @author Dave Raggett <a href="mailto:dsr@w3.org">dsr@w3.org </a> | |
59 | * @author Andy Quick <a href="mailto:ac.quick@sympatico.ca">ac.quick@sympatico.ca </a> (translation to Java) | |
60 | * @author Fabrizio Giustina | |
61 | * @version $Revision: 779 $ ($Author: fgiust $) | |
62 | */ | |
63 | public class Attribute | |
64 | { | |
65 | ||
66 | /** | |
67 | * attribute name. | |
68 | */ | |
69 | private String name; | |
70 | ||
71 | /** | |
72 | * don't wrap attribute. | |
73 | */ | |
74 | private boolean nowrap; | |
75 | ||
76 | /** | |
77 | * unmodifiable attribute? | |
78 | */ | |
79 | private boolean literal; | |
80 | ||
81 | /** | |
82 | * html versions for this attribute. | |
83 | */ | |
84 | private short versions; | |
85 | ||
86 | /** | |
87 | * checker for the attribute. | |
88 | */ | |
89 | private AttrCheck attrchk; | |
90 | ||
91 | /** | |
92 | * Instantiates a new Attribute. | |
93 | * @param attributeName attribute name | |
94 | * @param htmlVersions versions in which this attribute is supported | |
95 | * @param check AttrCheck instance | |
96 | */ | |
97 | 153 | public Attribute(String attributeName, short htmlVersions, AttrCheck check) |
98 | { | |
99 | 153 | this.name = attributeName; |
100 | 153 | this.versions = htmlVersions; |
101 | 153 | this.attrchk = check; |
102 | } | |
103 | ||
104 | /** | |
105 | * Is this a literal (unmodifiable) attribute? | |
106 | * @param isLiteral boolean <code>true</code> for a literal attribute | |
107 | */ | |
108 | 0 | public void setLiteral(boolean isLiteral) |
109 | { | |
110 | 0 | this.literal = isLiteral; |
111 | } | |
112 | ||
113 | /** | |
114 | * Don't wrap this attribute? | |
115 | * @param isNowrap boolean <code>true</code>= don't wrap | |
116 | */ | |
117 | 3 | public void setNowrap(boolean isNowrap) |
118 | { | |
119 | 3 | this.nowrap = isNowrap; |
120 | } | |
121 | ||
122 | /** | |
123 | * Returns the checker for this attribute. | |
124 | * @return instance of AttrCheck. | |
125 | */ | |
126 | 10168 | public AttrCheck getAttrchk() |
127 | { | |
128 | 10168 | return this.attrchk; |
129 | } | |
130 | ||
131 | /** | |
132 | * Is this a literal (unmodifiable) attribute? | |
133 | * @return <code>true</code> for a literal attribute | |
134 | */ | |
135 | 0 | public boolean isLiteral() |
136 | { | |
137 | 0 | return this.literal; |
138 | } | |
139 | ||
140 | /** | |
141 | * Returns the attribute name. | |
142 | * @return attribute name. | |
143 | */ | |
144 | 153 | public String getName() |
145 | { | |
146 | 153 | return this.name; |
147 | } | |
148 | ||
149 | /** | |
150 | * Don't wrap this attribute? | |
151 | * @return <code>true</code>= don't wrap | |
152 | */ | |
153 | 1198 | public boolean isNowrap() |
154 | { | |
155 | 1198 | return this.nowrap; |
156 | } | |
157 | ||
158 | /** | |
159 | * Returns the html versions in which this attribute is supported. | |
160 | * @return html versions for this attribute. | |
161 | * @see Dict | |
162 | */ | |
163 | 10418 | public short getVersions() |
164 | { | |
165 | 10418 | return this.versions; |
166 | } | |
167 | ||
168 | } |
|