Marcos Roriz $:

Pessoal, Geek, Anime, Jogos, Ciência da Computação e Open Source…

Delete or keep is the question.

leave a comment »

Hello guys, I’ve stumbled up on some tricky code here in Escher. More exactly theres a lot of parts that are *important* but are not used on the code, like this one:

 // Can be removed
 public static float [] linearize (float [] [] src) {
   int s1 = src [0].length;
   int s2 = src.length;
   float [] dst = new float [s1 * s2];

   for (int i=0; i<s2; i++) {
     int offset = i * s1;
     System.arraycopy (src [i], 0, dst, offset, s1);
   }
   return dst;
 }

  // Can't be removed
  public static float [] linearize (float [] [] [] src) {
    int s1 = src [0] [0].length;
    int s2 = src [0].length;
    int s3 = src.length;
    float [] dst = new float [s1 * s2 * s3];

    for (int i=0; i<s3; i++)
      for (int j=0; j<s2; j++) {
        int offset = s1 * (j + s2 * i);
        System.arraycopy (src [i] [j], 0, dst, offset, s1);
      }
    return dst;
  }

This method is part of the Misc class (which contains ‘handy’ methods for vector/graphic manipulation). So the question is, while this method does have it’s meaning in the program it’s not used anywhere on it. And to complicate it more the ‘same’ method with a different argument (3 dimension array) is used in the code. Should I remove it the unused??? I’m not totally sure but I think if they are not used we should remove it >_<‘. And that what I’ll probably do on my next commit. What you guys think? Should I keep or delete? :3

Other problems is that in general the classes uses a lot of public and static variables/methods, I’m doing some basic encapsulation on it. Also my next commit will include a revision/refactoring of the glorious gnu.x11.Display class with it’s > 1.4k lines of code. After I finish it’s refactoring the other classes will be easier, since they are usually < 200 lines of code. After classes refactoring is done is time to start going for the parser to generate automatic X11 code, the coolest part!

To sum it up I also received the confirmation that I can now commit oficially to GNU Classpath, so now I can submit code to XPeer there ^_^. Mr. Donald R. Robertson, III, J.D. sended me the confirmation. I’m honored to be able to contribute to a GNU project :]

Accepted by FSF =D~

PDF of the agreement

Written by marcosroriz

June 17, 2010 at 10:37 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: