Jump to content

ExperienceTable Class / snippet


Recommended Posts

Posted

Because I decided that's where that inheritance branch should end ph34r.png

There's no need for it to been extendable.

 

 

Making a class final really just makes it unextendable ^^

And there's no need for it not to be? I could think of plenty of methods/properties to add, making a class final should only be done when it's absolutely critical that nothing be overriden/extended for the functionality of the class to stay intact (which isn't the case here).

Posted

And there's no need for it not to be? I could think of plenty of methods/properties to add, making a class final should only be done when it's absolutely critical that nothing be overriden/extended for the functionality of the class to stay intact (which isn't the case here).

 

What kind of methods/properties would justify an extended class instead of just adding them to this one? I make my classes immutable and final by default, only making them mutable / extendable when it's absolutely necessary.

Posted (edited)

And there's no need for it not to be? I could think of plenty of methods/properties to add, making a class final should only be done when it's absolutely critical that nothing be overriden/extended for the functionality of the class to stay intact (which isn't the case here).

he didn't make all the methods final so we can still override ph34r.png

only the table generation cant be overriden because it's private

 

RSExperienceTable table = new RSExperienceTable() {

 

public int getXp(int level) {

        return 1337;

    }

 

}

Edited by VladBots
  • Developer
Posted

Might be better 'cpu-wise' to use a static table. Since CPU is more precious then the few bytes the table would use. 

 

I wouldn't worry about that CPU usage when it's calculated once and stored. It's not even that many calculations in the grand scheme of things anyways.

  • Like 1
  • 2 weeks later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...