/* * * $Author: work $ * $Revision: 1.5 $ * $Log: AllASMs.java,v $ * Revision 1.5 2000-03-31 20:14:31-06 work * toString() now displays count of ASMs for each * attribute * * Revision 1.4 2000-03-31 06:21:30-06 work * production release version 1 * * Revision 1.3 2000-03-31 05:52:06-06 work * this version was accidentally checked-in, * so please ignore * * Revision 1.2 2000-03-31 05:16:04-06 work * debugged working version * to do: * 1) create vector of keys (attributes) * 2) convert it to an array (that's what we store) * 3) sort it * * - toString() * * Revision 1.1 2000-03-29 21:14:18-06 work * Initial revision * */ /* * Copyright (C) 2000 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.*; import java.io.*; class AllASMs implements Serializable { public final int dimension; public final Hashtable ASMattributesToASMvectorHashtable; public final ASMattributes[] sortedAttributes; public final int count; private ASM A; private int lastNonUnitOfCurrentRow; private int[] lastNonUnitOfColumns; // constructor public AllASMs( int dimension ) { this.dimension = dimension; // the magic number of 67 is the next prime after // 47/0.75 where 47 is # of 3x3 ASMs and 0.75 is the // default load factor of the hash table ASMattributesToASMvectorHashtable = new Hashtable(67); lastNonUnitOfCurrentRow = 0; lastNonUnitOfColumns = new int[dimension]; for( int i=0; i < dimension; i++ ) lastNonUnitOfColumns[i] = 0; A = new ASM( dimension ); generateASM( 0, 0, 0, 0 ); Vector ASMattributesVector = new Vector(); Enumeration keysWalk = ASMattributesToASMvectorHashtable.keys(); while( keysWalk.hasMoreElements() ) ASMattributesVector.addElement( keysWalk.nextElement() ); sortedAttributes = new ASMattributes[ASMattributesVector.size()]; ASMattributesVector.copyInto( sortedAttributes ); new QuickSort( sortedAttributes ); int c = 0; for( int i=0; i