KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hdf > model > hdftypes > PropertyNode


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18 package org.apache.poi.hdf.model.hdftypes;
19
20
21 /**
22  * Represents a lightweight node in the Trees used to store formatting
23  * properties.
24  *
25  * @author Ryan Ackley
26  */

27 public class PropertyNode implements Comparable JavaDoc
28 {
29   private byte[] _grpprl;
30   private int _fcStart;
31   private int _fcEnd;
32
33   /**
34    * @param fcStart The start of the text for this property.
35    * @param fcEnd The end of the text for this property.
36    * @param grpprl The property description in compressed form.
37    */

38   public PropertyNode(int fcStart, int fcEnd, byte[] grpprl)
39   {
40       _fcStart = fcStart;
41       _fcEnd = fcEnd;
42       _grpprl = grpprl;
43   }
44   /**
45    * @return The offset of this property's text.
46    */

47   public int getStart()
48   {
49       return _fcStart;
50   }
51   /**
52    * @return The offset of the end of this property's text.
53    */

54   public int getEnd()
55   {
56     return _fcEnd;
57   }
58   /**
59    * @return This property's property in copmpressed form.
60    */

61   protected byte[] getGrpprl()
62   {
63     return _grpprl;
64   }
65   /**
66    * Used for sorting in collections.
67    */

68   public int compareTo(Object JavaDoc o)
69   {
70       int fcEnd = ((PropertyNode)o).getEnd();
71       if(_fcEnd == fcEnd)
72       {
73         return 0;
74       }
75       else if(_fcEnd < fcEnd)
76       {
77         return -1;
78       }
79       else
80       {
81         return 1;
82       }
83   }
84 }
85
Popular Tags