zhao
2021-07-02 23ee356c6f260ecc1a48bbb8bd60932b979e4698
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
 
/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) Under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for Additional information regarding copyright ownership.
   The ASF licenses this file to You Under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed Under the License is distributed on an "AS Is" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations Under the License.
==================================================================== */
 
 
namespace HH.WMS.Utils.NPOI.HSSF.Record
{
    using System;
    using System.Text;
    using System.Collections;
    using HH.WMS.Utils.NPOI.Util;
    using HH.WMS.Utils.NPOI.HSSF.Util;
 
 
    /**
     * Title:        RK Record
     * Description:  An internal 32 bit number with the two most significant bits
     *               storing the type.  This is part of a bizarre scheme to save disk
     *               space and memory (gee look at all the other whole records that
     *               are in the file just "cause"..,far better to waste Processor
     *               cycles on this then leave on of those "valuable" records out).
     * We support this in Read-ONLY mode.  HSSF Converts these to NUMBER records
     *
     *
     *
     * REFERENCE:  PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
     * @author Andrew C. Oliver (acoliver at apache dot org)
     * @author Jason Height (jheight at chariot dot net dot au)
     * @version 2.0-pre
     * @see org.apache.poi.hssf.record.NumberRecord
     */
 
    public class RKRecord : CellRecord
    {
        public const short sid = 0x27e;
        public static short RK_IEEE_NUMBER = 0;
        public static short RK_IEEE_NUMBER_TIMES_100 = 1;
        public static short RK_INTEGER = 2;
        public static short RK_INTEGER_TIMES_100 = 3;
 
        private int field_4_rk_number;
 
        public RKRecord()
        {
        }
 
        /**
         * Constructs a RK record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */
 
        public RKRecord(RecordInputStream in1)
            : base(in1)
        {
            field_4_rk_number = in1.ReadInt();
        }
 
        public int RKField
        {
            get { return field_4_rk_number; }
 
        }
 
        /**
         * Get the type of the number
         *
         * @return one of these values:
         *         <OL START="0">
         *             <LI>RK_IEEE_NUMBER</LI>
         *             <LI>RK_IEEE_NUMBER_TIMES_100</LI>
         *             <LI>RK_INTEGER</LI>
         *             <LI>RK_INTEGER_TIMES_100</LI>
         *         </OL>
         */
 
        public short RKType
        {
            get { return (short)(field_4_rk_number & 3); }
        }
 
        /**
         * Extract the value of the number
         * 
         * The mechanism for determining the value is dependent on the two
         * low order bits of the raw number. If bit 1 is Set, the number
         * is an integer and can be cast directly as a double, otherwise,
         * it's apparently the exponent and mantissa of a double (and the
         * remaining low-order bits of the double's mantissa are 0's).
         * 
         * If bit 0 is Set, the result of the conversion to a double Is
         * divided by 100; otherwise, the value is left alone.
         * 
         * [Insert picture of Screwy Squirrel in full Napoleonic regalia]
         *
         * @return the value as a proper double (hey, it <B>could</B>
         *         happen)
         */
 
        public double RKNumber
        {
            get { return RKUtil.DecodeNumber(field_4_rk_number); }
        }
 
 
        protected override String RecordName
        {
            get
            {
                return "RK";
            }
        }
 
 
        protected override void AppendValueText(StringBuilder sb)
        {
            sb.Append("  .value= ").Append(RKNumber);
        }
 
        protected override void SerializeValue(ILittleEndianOutput out1)
        {
            out1.WriteInt(field_4_rk_number);
        }
 
 
        protected override int ValueDataSize
        {
            get
            {
                return 4;
            }
        }
 
        public override short Sid
        {
            get { return sid; }
        }
 
        public new object Clone()
        {
            RKRecord rec = new RKRecord();
            CopyBaseFields(rec);
            rec.field_4_rk_number = field_4_rk_number;
            return rec;
        }
    }
}