Common Problems with strategy and comparison


Subject: Common Problems with strategy and comparison
From: John Sung (john_j_sung@yahoo.com)
Date: Mon Feb 11 2002 - 11:53:17 EST


I've notice that serveral people have asked questions pertaining to
ChangeDirectoryDown.

First, you need to obtain the string that contains the directory name. So,
having the strategy "from ChangeDirectoryDown to" + Main.FIdent should work.
It's because Main.FIdent is defined as " edu.neu.ccs.demeter.ident ".You can
also do, from CDD to FileName, then call get_ident() to get the Ident
object. It's pretty much the same it just happens to be a little more
intuitive.

If you want to compare directory names, you can use the equals() method for
the Ident or you can get the actual string via toString() method call. Then
use the string's equals() method. The reason why you want to use equals
instead of the == operator in java is that when you use == it checks to see
if the two objects are the exact same object, i.e. check to see if their
references are the same. What you want to check is to see if the two objects
are logically the same, i.e contain the same string.

Remember that you have serveral resource avaiable.

The demeterj java docs here:
http://www.ccs.neu.edu/research/demeter/DemeterJava/docs/api/

You should also reference the java 1.3 sdk java docs as well.

you can always grep for strings using grep in the main directory, i.e
grep "FIdent" *

or grep in the gen directory
grep "FIdent" *.java

Sometimes, it's easier to look in the gen directory for definitions of
methods since you can just find the .java file with the name of the class
and find the methods or data members. I do this frequently since trying to
find where a method is defined in .beh files can be alittle hard somtimes.

If you don't know what type an object is you can always print it out using
System.out.println(obj). You can also print out the actual class definition
by getting the Class object, getClass().

You can always send me e-mail to ask about any problems that you might have.
But please do include the actual code that you're having problems with. Most
of the it's little details that stops you from getting the programs working.
This is the main reason why I take 1 point off from your homeworks for
little mistakes. They don't seem to matter that much, until you start to
implement things. A little mistake can cost you time at least, but it can
also cost millions of dollars or even lives. If you take the Software
Engineering class, you'll find out how many different ways things can go
wrong and they often do.

John


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



This archive was generated by hypermail 2b28 : Mon Feb 11 2002 - 11:57:28 EST