mercredi 1 avril 2015

JAVA: Choosing algorithm based on multiple dimensions

I have an instance of class Address, which I have to change according to environment:

1) Region: base class with sub-classes RegionA and RegionB

2) Site: base class with sub-classes SiteA, SiteB and SiteC

3) Language: base class with sub-classes LanguageA and LanguageB

Each subclass defines constraints about Address modification.

The problem is that each tuple (Region, Site, Language) has to define its own modifier.


So, I have a method adjust(Address a, Region r, Site s, Language l).

What is the best design patter to use in this case?


Aucun commentaire:

Enregistrer un commentaire