1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3
* Copyright (C) 1998-2001 Gerwin Klein <lsf@jflex.de> *
4
* All rights reserved. *
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License. See the file *
8
* COPYRIGHT for more information. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License along *
16
* with this program; if not, write to the Free Software Foundation, Inc., *
17
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
19
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26
* A list of pairs of states. Used in DFA minimization.
28
* @author Gerwin Klein
29
* @version JFlex 1.3.5, $Revision: 1.14 $, $Date: 2001/10/08 10:08:06 $
31
final public class StatePairList {
33
// implemented as two arrays of integers.
34
// java.util classes proved too inefficient.
41
public StatePairList() {
47
public void addPair(int i, int j) {
48
for (int x = 0; x < num; x++)
49
if (p[x] == i && q[x] == j) return;
59
public void markAll(StatePairList [] [] list, boolean [] [] equiv) {
60
for (int x = 0; x < num; x++) {
66
if (list[i][j] != null)
67
list[i][j].markAll(list, equiv);
72
private void ensureSize(int length) {
73
if ( p.length > length ) return;
75
length = Math.max(length+1, 2*p.length);
77
int pn [] = new int[length];
78
int qn [] = new int[length];
80
System.arraycopy(p, 0, pn, 0, p.length);
81
System.arraycopy(q, 0, qn, 0, q.length);