Captive Imagination
September 10, 2010, 03:45:40 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: jSeamless 1.0 Beta 7 is Available http://www.jseamless.org
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Proposed additions and changes to several utilities  (Read 3989 times)
0 Members and 1 Guest are viewing this topic.
standtrooper
Developer
Sr. Member
*****
Offline Offline

Posts: 250


View Profile
« on: February 01, 2007, 10:00:47 AM »

These classes are my proposed additions with the exception of StringUtilities which contains my additions and removed several Date utilities and refactored them to DateUtil with some of my proposed additions.

* DateUtility.java (7.27 KB - downloaded 168 times.)
* ListUtil.java (1.19 KB - downloaded 165 times.)
* StringUtilities.java (17.79 KB - downloaded 174 times.)
* TypeParser.java (5.09 KB - downloaded 179 times.)
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #1 on: February 01, 2007, 10:29:47 AM »

Some of your code has me concerned:

Code:
public static String reverseLookupMonth(int month) {
        //the month returned is 1 based, the result we need is 0 based.
        int monthus = month - 1;

        String returner = null;

        for (int i = 0; i < DateUtility.MONTHS_INT.length; i++) {
            if (DateUtility.MONTHS_INT[i] == monthus) {
                returner = DateUtility.MONTHS_STR[i];
                break;
            }
        }

        return returner;
    }

Could that method simply be:

Code:
public static String reverseLookupMonth(int month) {
    month--;
    if ((DateUtility.MONTHS_STR.length < month) || (month < 0)) return null;
    return DateUtility.MONTHS_STR[month];
}

Huh
Logged
standtrooper
Developer
Sr. Member
*****
Offline Offline

Posts: 250


View Profile
« Reply #2 on: February 01, 2007, 10:32:03 AM »

I'd be worried about that as well, but I'm pretty sure that's not my code, but the refactored code from StringUtilities.  I'll have a look, if it is mine, I'm going to have to go back through it all again.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #3 on: February 01, 2007, 10:33:41 AM »

Just looked in StringUtilities...it ain't mine. Wink
Logged
standtrooper
Developer
Sr. Member
*****
Offline Offline

Posts: 250


View Profile
« Reply #4 on: February 01, 2007, 10:39:46 AM »

ok, well, I don't remember writing that part either... and that has me really concerned!

I'll scrub the rest of the code and see if there's anything else in there that sucks ***. 

apologies for the code, I didn't think it was mine b/c before I added the files, I tried to add javadocs to all of my methods since I noticed that there weren't many, if any, in jcommons.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #5 on: February 01, 2007, 11:34:40 AM »

Well, jCommon hasn't really received much love...it's just my repository of stuff I've written that I can commonly use between applications I'm developing.  I put it out because friends/coworkers/etc had asked me to but I really haven't given it any time to "pretty it up" or even clean up the API.
Logged
standtrooper
Developer
Sr. Member
*****
Offline Offline

Posts: 250


View Profile
« Reply #6 on: February 01, 2007, 12:08:43 PM »

that's how my java utilities is as well.  I was only commenting that I commented to distinguish the code I added from the code I refactored.   I figured that trying to add methods to existing classes or new classes I'm the only one that may understand and find what i'm looking for, so I'd add a small comment just to say briefly what it does.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #7 on: February 01, 2007, 12:16:38 PM »

I'm not even sure for the combat demo we'll be using jCommon, so at this point I don't really want to spend much time on jCommon, I'd rather be spending that time on "the other" endeavor. Wink
Logged
standtrooper
Developer
Sr. Member
*****
Offline Offline

Posts: 250


View Profile
« Reply #8 on: February 01, 2007, 12:30:22 PM »

I agree.  I was trying to refactor most, if not all, of gdju to jcommon cause I'm tired of managing so many projects... however, as you pointed out, there are definitely some sections of code that I didn't know about, didn't write or probably just copied from somewhere else to use as a temporary section of code.

I'll forego the additions for now, maybe come back to it some other time.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.257 seconds with 22 queries.