Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11414

Re: enum paralellism

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: enum paralellism
Date 2012-01-17 10:08 -0800
Organization Canadian Mind Products
Message-ID <dodbh7t37pqvn5teiu806s627h1hl0070v@4ax.com> (permalink)
References <4tb8h7h2tul5rq4m5bk9sg485tq33qi394@4ax.com> <jf1g0r$ua$1@dont-email.me>

Show all headers | View raw


On Mon, 16 Jan 2012 10:33:46 -0500, Eric Sosman
<esosman@ieee-dot-org.invalid> wrote, quoted or indirectly quoted
someone who said :

>     Is this parallelism a result of using classes from different
>sources, each with its own enum to represent the same set of things?

Is is a general question hoping to collect techniques that might apply
in different circumstances.  However, what triggered it is I have
three different enums:

1. online bookstores where you look things up by ISBN.  I probe the
bookstore to see if they have a given book in stock by looking for
snippets in the response e.g.

        AMAZONCOM( "amazon.com",
                "www.amazon.com",
                CountryFlag.USA,
                Global.configuration.getAccountForAmazonCom(),
                ISBNsInStock.NO_DELAY,
                new String[] {
                        ">these sellers<",
                        "Available from",
                        "In Stock",
                        "In stock",
                        "Limited Availability",
                        "This title has not yet been released",
                        "Usually ships within",
                        "left in stock" },

                new String[] {
                        "Currently unavailable",
                        "Looking for something?",
                        "Sign up to be notified when this item becomes
available",
                        "out of stock", "did not match any products"
},

                new String[] { }, 1789, 9325 )
                {
                int doesThisBookstoreCarry( final String isbn13 )
                    {
                    return doesGenericAmazonCarry( this, isbn13 );
                    }
                },

There are similar enums for DVDs stores that look up by UPC, and 
Amazon stores that look up by ASIN. The other way to deal with it
would be to combine them in to one big enum with parms to keep track
of the subtype.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is 
"If you change this, remember to change ?XXX? too".
 

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

enum paralellism Roedy Green <see_website@mindprod.com.invalid> - 2012-01-16 06:16 -0800
  Re: enum paralellism Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-16 10:33 -0500
    [OT] East and West in Oz (Was: enum paralellism) Lew <noone@lewscanon.com> - 2012-01-16 10:32 -0800
    Re: enum paralellism Roedy Green <see_website@mindprod.com.invalid> - 2012-01-17 10:08 -0800
      Re: enum paralellism Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-17 10:37 -0800
  Re: enum paralellism Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-17 10:34 -0800

csiph-web