Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(thumbs up)

(thumbs down)

Code Block
enum MyClassFlags {doThingX, doThingY, doThingZ};
Code Block
int obscureFlag;    class MyClass {
    MyClassFlags flags;
    void setFlags(EnumSet f) {flags = f;}
}
...
xy.setObscureFlag(3
EnumSet<MyClassFlags> myFlags = new EnumSet<MyClassFlags>();
myFlags.add(MyClassFlags.doThingX); // yes, {color:red}NEVER hardcode numbers like this !!!{color}it is more verbose. That is a good thing !
MyClass c;
c.setFlags(myFlags);
Code Block
class Obscure {
    int obscureFlag;
    void setObscureFlag(int o) {obscureFlag = o;}
}
...
Obscure o
o.setObscureFlag(3);
Note

Never hardcode numbers

"Overloaded Operators"

It is very confusing to have members like add(Object o1, Object o2) as members of the classes. This is counter-intuitive. Either there ought to be a supporter class with static members only, or the member of the type class expects only one argument.
So, design it to look like this:

...