I'm building an app for android which allows objects to be merged together based on certain conditions. At the moment I'm looking to do this using if
statements (nested or not) and am just wondering if there is a better way to do this so it is more flexible and easily expanded.
For example, I have 6 objects, 3 of them are red, 2 are blue and 1 is green.
The rules that can be applied to that are:
- 3 red can be merged
- 2 blue can be merged
- 1 red and 1 blue and 1 green can be merged
- 1 red and 1 blue can be merged
- 1 red and 1 green can be merged
- 1 green and 1 blue can be merged
That is a very basic example of it. There will be a lot more than that.