Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
ByteVector.cs
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 
19 //using System;
20 
21 //namespace Lucene.Net.Analysis.Compound.Hyphenation
22 //{
23 // ///////
24 // /// This class implements a simple byte vector with access to the underlying
25 // /// array.
26 // /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
27 // ////
28 
29 // [Serializable]
30 // public class ByteVector
31 // {
32 // ///<summary>
33 // /// Capacity increment size
34 // ///</summary>
35 // private static int DEFAULT_BLOCK_SIZE = 2048;
36 
37 // private int blockSize;
38 
39 // ///<summary>
40 // /// The encapsulated array
41 // ///</summary>
42 // private byte[] array;
43 
44 // ///<summary>
45 // /// Points to next free item
46 // ///</summary>
47 // private int n;
48 
49 // public ByteVector()
50 // : this(DEFAULT_BLOCK_SIZE)
51 // {
52 
53 // }
54 
55 // public ByteVector(int capacity)
56 // {
57 // if (capacity > 0)
58 // {
59 // blockSize = capacity;
60 // }
61 // else
62 // {
63 // blockSize = DEFAULT_BLOCK_SIZE;
64 // }
65 // array = new byte[blockSize];
66 // n = 0;
67 // }
68 
69 // public ByteVector(byte[] a)
70 // {
71 // blockSize = DEFAULT_BLOCK_SIZE;
72 // array = a;
73 // n = 0;
74 // }
75 
76 // public ByteVector(byte[] a, int capacity)
77 // {
78 // if (capacity > 0)
79 // {
80 // blockSize = capacity;
81 // }
82 // else
83 // {
84 // blockSize = DEFAULT_BLOCK_SIZE;
85 // }
86 // array = a;
87 // n = 0;
88 // }
89 
90 // public byte[] GetArray()
91 // {
92 // return array;
93 // }
94 
95 // ///<summary>
96 // /// return number of items in array
97 // ///</summary>
98 // public int Length()
99 // {
100 // return n;
101 // }
102 
103 // ///<summary>
104 // /// returns current capacity of array
105 // ///</summary>
106 // public int Capacity()
107 // {
108 // return array.Length;
109 // }
110 
111 // public void Put(int index, byte val)
112 // {
113 // array[index] = val;
114 // }
115 
116 // public byte Get(int index)
117 // {
118 // return array[index];
119 // }
120 
121 // ///
122 // /// This is to implement memory allocation in the array. Like malloc().
123 // ///
124 // public int Alloc(int size)
125 // {
126 // int index = n;
127 // int len = array.Length;
128 // if (n + size >= len)
129 // {
130 // byte[] aux = new byte[len + blockSize];
131 // Array.Copy(array, 0, aux, 0, len);
132 // array = aux;
133 // }
134 // n += size;
135 // return index;
136 // }
137 
138 // public void TrimToSize()
139 // {
140 // if (n < array.Length)
141 // {
142 // byte[] aux = new byte[n];
143 // Array.Copy(array, 0, aux, 0, n);
144 // array = aux;
145 // }
146 // }
147 // }
148 //}