zhao
2021-07-02 081df17b8cc4a6e7e4f4e1e1887f24810e3ec2f9
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
using System;
using System.Collections.Generic;
using System.Text;
using HH.WMS.Utils.NPOI.HSSF.Model;
 
namespace HH.WMS.Utils.NPOI.HSSF.Record.Aggregates
{
    internal class PLSAggregate : RecordAggregate
    {
        private static ContinueRecord[] EMPTY_CONTINUE_RECORD_ARRAY = { };
        private Record _pls;
        /**
         * holds any continue records found after the PLS record.<br/>
         * This would not be required if PLS was properly interpreted.
         * Currently, PLS is an {@link UnknownRecord} and does not automatically
         * include any trailing {@link ContinueRecord}s.
         */
        private ContinueRecord[] _plsContinues;
 
        public PLSAggregate(RecordStream rs)
        {
            _pls = rs.GetNext();
            if (rs.PeekNextSid() == ContinueRecord.sid)
            {
                List<ContinueRecord> temp = new List<ContinueRecord>();
                while (rs.PeekNextSid() == ContinueRecord.sid)
                {
                    temp.Add((ContinueRecord)rs.GetNext());
                }
                _plsContinues = new ContinueRecord[temp.Count];
                _plsContinues = temp.ToArray();
            }
            else
            {
                _plsContinues = EMPTY_CONTINUE_RECORD_ARRAY;
            }
        }
 
        public override void VisitContainedRecords(RecordVisitor rv)
        {
            rv.VisitRecord(_pls);
            for (int i = 0; i < _plsContinues.Length; i++)
            {
                rv.VisitRecord(_plsContinues[i]);
            }
        }
 
    }
}