Mercurial > projects > dwt-addons
comparison dwtx/jface/text/rules/BufferedRuleBasedScanner.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | eb21d3dfc767 |
children | eb98a5cbfd78 |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
56 /** The default buffer size. Value = 500 */ | 56 /** The default buffer size. Value = 500 */ |
57 private const static int DEFAULT_BUFFER_SIZE= 500; | 57 private const static int DEFAULT_BUFFER_SIZE= 500; |
58 /** The actual size of the buffer. Initially set to <code>DEFAULT_BUFFER_SIZE</code> */ | 58 /** The actual size of the buffer. Initially set to <code>DEFAULT_BUFFER_SIZE</code> */ |
59 private int fBufferSize= DEFAULT_BUFFER_SIZE; | 59 private int fBufferSize= DEFAULT_BUFFER_SIZE; |
60 /** The buffer */ | 60 /** The buffer */ |
61 private char[] fBuffer= new char[DEFAULT_BUFFER_SIZE]; | 61 private char[] fBuffer; |
62 /** The offset of the document at which the buffer starts */ | 62 /** The offset of the document at which the buffer starts */ |
63 private int fStart; | 63 private int fStart; |
64 /** The offset of the document at which the buffer ends */ | 64 /** The offset of the document at which the buffer ends */ |
65 private int fEnd; | 65 private int fEnd; |
66 /** The cached length of the document */ | 66 /** The cached length of the document */ |
71 * Creates a new buffered rule based scanner which does | 71 * Creates a new buffered rule based scanner which does |
72 * not have any rule and a default buffer size of 500 characters. | 72 * not have any rule and a default buffer size of 500 characters. |
73 */ | 73 */ |
74 protected this() { | 74 protected this() { |
75 super(); | 75 super(); |
76 fBuffer= new char[DEFAULT_BUFFER_SIZE]; | |
77 fBuffer[] = 0; | |
76 } | 78 } |
77 | 79 |
78 /** | 80 /** |
79 * Creates a new buffered rule based scanner which does | 81 * Creates a new buffered rule based scanner which does |
80 * not have any rule. The buffer size is set to the given | 82 * not have any rule. The buffer size is set to the given |
82 * | 84 * |
83 * @param size the buffer size | 85 * @param size the buffer size |
84 */ | 86 */ |
85 public this(int size) { | 87 public this(int size) { |
86 super(); | 88 super(); |
89 fBuffer= new char[DEFAULT_BUFFER_SIZE]; | |
90 fBuffer[] = 0; | |
87 setBufferSize(size); | 91 setBufferSize(size); |
88 } | 92 } |
89 | 93 |
90 /** | 94 /** |
91 * Sets the buffer to the given number of characters. | 95 * Sets the buffer to the given number of characters. |
94 */ | 98 */ |
95 protected void setBufferSize(int size) { | 99 protected void setBufferSize(int size) { |
96 Assert.isTrue(size > 0); | 100 Assert.isTrue(size > 0); |
97 fBufferSize= size; | 101 fBufferSize= size; |
98 fBuffer= new char[size]; | 102 fBuffer= new char[size]; |
103 fBuffer[] = 0; | |
99 } | 104 } |
100 | 105 |
101 /** | 106 /** |
102 * Shifts the buffer so that the buffer starts at the | 107 * Shifts the buffer so that the buffer starts at the |
103 * given document offset. | 108 * given document offset. |