Q: How do I make a generic array without the compiler complaining?
A: array = (T[]) new Object[ARRAY_SIZE];
Q:
If we use select twice in a row, do the things that were selected the
first time stay selected after the second select operation?
A: From page 2 of the handout: "For each record in the table, if
the select test is true, then the record's selected boolean is set
to true. If the test is false, the record's selected boolean is left
unchanged." In short, yes.
Q:
Can we assume all the input files are formatted correctly?
A: Yes, you can assume the records and bindings in the input files are formatted correctly... i.e. as specified in the handout.
Q:
Can we assume all criterion records given as input to the command line interface are formatted correctly?
A: Yes.
Q:
Am I expected to deal with an empty criterion record?
A: Yes. The definition of 'AND' and 'OR' given in the assignment covers this case.
Q:
What do we do with a leading '*' (if present) in front of a DBRecord in a text file?
A: Skip the '*'. All records should have their "selected" value set to false initially.
Q:
How is ChunkList expected to perform against a LinkedList and ArrayList?
A: The ChunkList should always perform better (Correction: *almost* always since the GC could kick in anytime or the machine load could suddenly change) than the ArrayList (and significantly so... close to an order of magnitude). It should perform better than the LinkedList in a majority of the cases - it's okay if the ChunkList is slower on occasion (but if the ChunkList is slower 5 times out of 5, then something isn't right). Take the actual performance numbers with a grain of salt. They will vary from machine to machine and from run to run.
Q:
How do I deal with duplicate records?
A: Duplicate records don't need any special handling... i.e. you don't need to ensure records are distinct. For e.g. If you read the same file in twice, you should have two copies of each record in your database.
Q:
What's the best way to read in a file line-by-line?
A: In short, wrap a FileReader within a BufferedReader and call readLine() repeatedly until you get back a null value. The syntax for constructing a BufferedReader will look something like:
BufferedReader in = new BufferedReader(new FileReader(fileName));
Q:
How come Eclipse complains about a FileNotFoundException even before I run
my program?
A:
It's probably because you don't have a try/catch block wrapped around your
BufferedReader in = new BufferedReader(new FileReader(filename))
code. Look at how the CLI does it.
Q:
In Eclipse, I go to Project-->Generate Javadoc..., but I don't know what
the "Command" is.
A:
You need to specify the location of your javadoc.exe. For Windows users,
it's in your Java folder. If you can't find it there, you might
need to install the JDK.
For Mac users, the location is at:
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javadoc.
To select a particular JDK version, substitute CurrentJDK with one of
the version dirs located in the same directory. You'll probably have
to do this to get the JDK 1.5 binaries if you're running OS 10.4.x,
because the 1.5 installer from Apple doesn't make 1.5 the default
version. (Thanks to Jeremy Joslin)
Q:
May we use StringTokenizer?
A:
Yes, but that does not mean you need to.
Q:
My puzzle queries are returning two different values. What's wrong?
A:
First, if you are using your ChunkList, you can revert your code back
to using ArrayList and see if the problem persists. It will probably
go away, which means that you have a bug in your code.
Q:
How many solutions do the provided puzzles have for Sudoku?
A:
All the provided puzzles have just 1 solution -- it's regarded
as most proper for a Sudoku puzzle to be that way.
However, you can start putting zeroes in to get multiple solutions.
For example, changing the 7 near the upper left of the hard puzzle
should have 6 solutions. (This is easiest to play with when you have
the GUI working.)