3

I have static data which represents a Skin that has parts such as

  • head
  • body
  • right hand
  • left hand
  • right leg
  • left leg

and each of those parts have sides/faces:

  • top
  • bottom
  • left
  • right
  • back
  • front

Now I want to represent these in my code in such a way that I can relate them to each other such as

SkinPart.HEAD.TOP
SkinPart.HEAD.BOTTOM

and also from the sub part(top, bottom) i want to be able to access the data, whose top side is this?

Is this kind of relation possible to do in compile time(?)

My current implementation includes enums at it gets really messy..

I have bunch of maps that has parts as keys and side maps as values..

The compile time relation isn't really nessaccary.. I was just wondering how design wise I should do this without being bloated with maps of maps and without the need to write custom search functions in order to keep tracks whats whos

Is the only way to go to create a class and dynamically fill the lists and lose the ability to statically access the data eventhough the types are known and will never change(?)

Ruuhkis
  • 1,924
  • 1
  • 27
  • 46
  • By static do you mean static or do you mean final? – CodeCamper Apr 16 '14 at 20:52
  • Neither, I mean data that is predefined and is accessible at code level, such as enums, like if i create enum Part {HEAD, BODY;} I can access those parts like Part.HEAD or Part.BODY – Ruuhkis Apr 16 '14 at 20:53
  • 2
    I might be a little confused as to what exactly you are looking for... [does this answer your question?](http://stackoverflow.com/questions/7296785/using-nested-enum-types-in-java) – CodeCamper Apr 16 '14 at 20:56
  • I didn't know you could have enum inside enum.. That's brilliant! Thanks! – Ruuhkis Apr 17 '14 at 21:56

1 Answers1

0

If I were you and if I had understood your question right, I would write a superclass with all the sides/faces with an access modifier of protected (only packages and subclasses). Then you can extend your Skin with the sides/faces

Mansouritta
  • 166
  • 1
  • 1
  • 10