×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

The Eureka Moment

The Eureka Moment

The Eureka Moment

(OP)
So as you may recall I have posted several threads in this forum trying to understand OOP and I wanted to share with everyone my "Eureka Moment"!!  I have been reading Head First Java for the past week or so and I'm getting towards the end and I see an example for a Jukebox and it's songs and the light bulb finally came on!  

I immediately saw how an assignment I was given today should be done!  The constructors, the test class, the getters and setters, everything just came together!

So I want to thank all of you that helped in creating the foundation that the Head First book was able to build on in such a way that I GET IT!!!

Here's my first new class!!  It doesn't really DO very much yet, but I'll get to that, for now I'm just FRICKIN' THRILLED THAT I GET IT!!  Of course if you see something that I'm doing wrong, please feel free to burst my bubble!!

CODE


public class ScannedImageFolder {
    
    public String currentFolder;
    private int imageCount;
    private boolean timeToChange = false;
    
    ScannedImageFolder(String c){
        currentFolder = c;
    }
    
    public String getCurrentFolder (){
        return currentFolder;
    }
    
    public void setCurrentFolder(String c){
        currentFolder = c;
    }

    private void setImageCount() {
        //code to get # of files
        //imageCount = # of files;
        imageCount = 11500;
    }
    
    private void settimeToChange () {
        if (imageCount > 12000){
            timeToChange = true;
        }
    }
}

And suggestions on how to take in a location=
currentFolder = "\\srvname\images\Citations\0000044"

and find that location and get the number of files in that folder?

Leslie

Have you met Hardy Heron?

RE: The Eureka Moment

It's always a greate moment when the light bulb turns on:) It's been my experience that the frequency of "Aha" increases the more you learn.

I'm not fimilar with java, I'm a c# dev. with .net there is a System.IO namespace which contains all kinds of objects for files and streams. If java contains a similar namespace I would start there and look for an object which accesses Directories (or Files, or both)

for example in .net there is the DirectoryInfo (intance) and Directory (static) objects which allow me to acess a director path. from there I can modify the directory and access files/subdirectories.

With your speicific example I would make the directory path a read only property that must be included when the object is instantiated.  If the user needs to change directrories, return a new ScannedImageFolder.

Jason Meckley
Programmer
Specialty Bakers, Inc.

RE: The Eureka Moment





Jason Meckley,

Any relationship to Jim Meckley in Williamsport?
 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: The Eureka Moment

none that I'm aware of.

Jason Meckley
Programmer
Specialty Bakers, Inc.

RE: The Eureka Moment



Thanks for responding.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close