I'm new to Java but not to basic programming. Because of this, I have not yet fully learned all of the terms and their meaning. With that being said, I may not be describing what I want so I'll try to be as specific as possible.
I am writing an abstract parent class Status which will parent subclasses such as (Buff) and (Debuff) which will most likely be abstract as well. Suffice to say that eventually I will be writing concrete classes with their own class names that inherit, in some way, from Status.
The idea is to iterate through a list of these objects and have them modify another Dragon.object. The order becomes important though because these Status objects mathematically modify values in another class of objects. Because of this and the fact that there is no order that these objects will be instantiated, I would end up with unintended results when one Status increases a value by 10% and another subtracts 5 from that value.
The reason I provide this background is because I'm not sure that I am approaching this problem correctly and hope that if I am going down the wrong path, someone can correct me here.
On to my question; it seems easy enough to compare objects by a value in one of their fields. Does this hold true for class types as well? If so, how would I write a comparator that compares object types. By "object types", i mean;
compare: Status.Buff.Percentage.Strength10Percent to Status.Buff.Additive.Strength10
Should I just place a field in this class that designates it's priority and then use a custom comparator when sorting or is the object type enough (provided Java can do that)?
Thanks for reading.