2 * Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 #include <lttoolbox/sorted_vector.h>
25 SortedVector::copy(SortedVector
const &o
)
27 sv
= new SVNode
[o
.size
];
30 for(int i
= 0; i
!= size
; i
++)
32 sv
[i
].tag
= o
.sv
[i
].tag
;
33 sv
[i
].dest
= o
.sv
[i
].dest
;
38 SortedVector::destroy()
43 SortedVector::SortedVector(int const fixed_size
)
45 sv
= new SVNode
[fixed_size
];
49 SortedVector::~SortedVector()
54 SortedVector::SortedVector(SortedVector
const &o
)
60 SortedVector::operator =(SortedVector
const &o
)
71 SortedVector::add(int tag
, MatchNode
*dest
, int pos
)
78 SortedVector::search(int tag
)
80 int left
= 0, right
= size
-1;
83 int mid
= (left
+right
)/2;
84 if(sv
[mid
].tag
== tag
)