|
C M S C 2 1 4 C o m p u t e r S c i e n c e I I F a l l 2 0 0 3 |
NO! I am saying there are 2 cases BOTH of which you must implement. So if you can't find a word (it is not in the codebook dll and it is not a plural of a word in the codebook dll):
NO! Because while most functions are the same, the last 2 are
different enough. The setters for Word/Pair - one sets a string the
other a string in a pair; and the writer() functions - one prints a
string and one prints text and a 4 digit code.
Yes!!! I'm sorry for the error in the last
faq. I left out the important words "a pointer to". "it"
is a MNode * object. so operator->() has to return the MNode
* object
"curr". This means that if the iterator, it, is pointing to
a node, you can do
it->getRight(), it->getLeft(),
and it->getWord().
Yes it does and I have changed the header files'
comment to reflect this.
Since DllIterator has a data member TNode See my version of Encoder.h in the posting account in Projects/P2/Sample/Encoder.h
In Encoder.h TNode Since they are private function in Codebook and Decodebook,
respectively, it is easiest to call them from checkCodebook() in Encoder and
decode() in Decoder. Yes. It reads every line of the message (or code). It reads until
EOF. Do NOT call this in main() in a loop. Good question! Since a generic type might be a string or integer
or double or character or even a class object, you can't just set the
default value to 0 or "", etc. So call the default constructor for your
genetic type. If your generic type is T, for example, you could call
T(); The only CLASSES that have to be templatized (ie have a template
prefix in the .h file) are TNode and DllIterator. No! Unless you want to go back and rework code that is (possibly)
already working. Don't worry, we will be able to test it even if you
didn't use DllIterator in Encoder. No. You should read the "checklist" which was posted long ago as
it lists what you should submit (and it doesn't include MNode). MNode
should no longer exist (but Node still does). The "checklist" is the
very first link on the project description webpage
Note: You should templatize TNode and DllIterator - and NO OTHER
CLASSES. You may have to modify the header files of other classes
to use the new TNode (instead of MNode) - and this is fine (but doesn't
give you the freedom to make just any changes - only those needed to
incorporate TNode in place of where MNode used to be, and to modify
DllIterator to be templatized where needed).
Project #2 is now due on Friday, October 17th by 11pm. Due to the
CMSC 250 midterm exam on Thursday this extension was granted. Note:
it is strongly recommended that you still attempt to submit something
PRIOR to Friday afternoon.
No it doesn't. That comment was about the insert() in Codebook. I
have changed the web page to reflect this. Be certain you are not using
a sort to alphabetize the pairs from codebook.txt in Codebook. This is one of the things YOU change once you have TNode
working. NO! They MUST remain as defined. When/if we test them,
the output must diff correctly. Correspondingly, you should be
throwing appropriate exceptions and actually TESTING them. Yes they do the same thing. I put copy() in there because so many
students were writing it anyway to coincide with the way they were
taught to write the copy() method called by a copy constructor. You are not only allowed to modify the DllIterator header file to
take a templatized type, you SHOULD modify it. It does not make sense to
leave it as string. Modifying a header file does NOT
MEAN changing prototype parameters, return types or functionality, NOR
DOES IT MEAN adding public member functions. No it can't return false. This function changed when I added
checkCodebook() but I forgot to change the return type. So it will always
return true. If you are thinking of an expression such as "united states of
america" when "united" and "of" also appear in the codebook.txt but not
"states" or "america" then you are correct in thinking this is
complicated. So let's limit expressions (this time) to scanning forward
from the first (non-plural) word you can't find or scanning backward from
the first (non-plural) word you can't find, BUT NOT BOTH. You are going to change Mnode to TNode so there is no TNode (of
ours) for you to compare it against. In the other header files which will
be impacted, just change the MNodes and if you use the
generic type T, your other header files should diff with
ours. It should be pointing to NULL. This will prevent your code from
trying to use getRight(), getLeft() or getWord() when the
iterator is pointing to NULL. Remember, you can "walk off" a dll
in either direction.
Yes, it should return a pointer to an MNode. I have
changed it in the posting account.
Project #2 is due by 11pm on Thursday, October 16th, 2003.
DllIterator(TNode<std::string> *currIn = NULL);
we would have
DllIterator(TNode<T> *currIn = NULL);
Note:
any project may be turned in late up to 2 days as specified on the
class syllabus.
For details regarding the late policy and any
penalties associated with submitting late projects please see the
class syllabus.
|
See the class syllabus for policies concerning email Last Modified: Tue Oct 14 14:32:10 EDT 2003 |
|
|
|
|
|