• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Good Java Design pattern/implementation approach suggestion for the below case.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the question regarding the code snippet below.


Iterate through the Component and run isRelevance over components.


Secondly based on the combination of Components with true/false, we will arrive with name.
Ex: CompA is relevant, B is relevant and C is not. ===> "Good"
CompA is not relevant, B is relevant and C is not. ===> "Better"
I was thinking of creating a Map with 1/0 bit flags combination and assigning the name. Say "110" => Good.
Can i have some suggestions on giving a better design/implementation approach for this?
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not in love with the idea of a bitmap for this purpose, but it could work. Are there different names for each of the eight possible combinations? Will there always be exactly three components? If not, how does that affect the mapping to name?
 
Greenhorn
Posts: 5
Spring AngularJS Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Since this is collection, relating to 2nd part of the question

based on the combination of Components with true/false, we will arrive with name.


How do you intend to identify/group a set of three OR n (each time), for evaluating the name (linearly).

How about using a Builder pattern to create/evaluate to a name.
 
Do you pee on your compost? Does this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic