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


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

Re: local constants with switch

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Andreas Leitgeb <avl@auth.logic.tuwien.ac.at>
Newsgroups comp.lang.java.programmer
Subject Re: local constants with switch
Date Sat, 16 Aug 2014 09:01:49 +0000 (UTC)
Organization A noiseless patient Spider
Lines 20
Message-ID <slrnluu7ft.fp3.avl@login.logic.tuwien.ac.at> (permalink)
References <slrnlukhpi.fp3.avl@login.logic.tuwien.ac.at> <myenuyioa1ym$.39yw0wm1njk2.dlg@40tude.net> <53eec579$0$302$14726298@news.sunsite.dk>
Reply-To avl@logic.at
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Sat, 16 Aug 2014 09:01:49 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="7fd0c836d94caf9f0b88d96117d7c68e"; logging-data="26108"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196uXODIrYJKbobJWTLeLQN"
User-Agent slrn/pre1.0.0-18 (Linux)
Cancel-Lock sha1:N5Kpyccy+iwaGOZVY4GKjwhDHPI=
Xref csiph.com comp.lang.java.programmer:29688

Show key headers only | View raw


Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 8/15/2014 7:18 PM, Joerg Meier wrote:
>> I remember a very early piece of code I was trying to write,
>> private static final int i = 0;
>> private static final int LEFT = i++;
>> private static final int RIGHT = i++;
>> private static final int UP = i++;
>> private static final int DOWN = i++;
>> As I had a lot of int constants, I was worried about keeping track of what
>> numbers were in use,
>
> If all the constants are the same place and in numeric order, then
> it should not be that hard.

Jörg's problem is about that code being under work,
and new constants being added *not* only at the end.

I guess, enums might actually help.
(The enum itself can be privately nested in current class)

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


Thread

local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-12 16:56 +0000
  Re: local constants with switch Donkey Hottie <donkey@fredriksson.dy.fi> - 2014-08-12 20:30 +0300
  Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-12 21:15 +0000
    Re: local constants with switch Silvio <silvio@internet.com> - 2014-08-12 23:20 +0200
    Re: local constants with switch Silvio <silvio@internet.com> - 2014-08-12 23:22 +0200
  Re: local constants with switch Lew <lewbloch@gmail.com> - 2014-08-15 15:22 -0700
    Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-16 00:24 +0000
      Re: local constants with switch Roedy Green <see_website@mindprod.com.invalid> - 2014-08-18 23:46 -0700
        Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-21 13:57 +0000
          Re: local constants with switch Joerg Meier <joergmmeier@arcor.de> - 2014-08-21 18:52 +0200
            Re: local constants with switch Mike Amling <mamling@chaff.us> - 2014-08-21 13:19 -0500
              Re: local constants with switch Joerg Meier <joergmmeier@arcor.de> - 2014-08-21 22:41 +0200
            [OT] Re: local constants with switch Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-21 14:42 -0400
              Re: [OT] Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-21 19:21 +0000
                Re: [OT] Re: local constants with switch Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-08-21 22:30 -0500
                Re: [OT] Re: local constants with switch Silvio <silvio@internet.com> - 2014-08-23 14:01 +0200
                Re: [OT] Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 15:22 +0000
              Re: [OT] Re: local constants with switch Arne Vajhøj <arne@vajhoej.dk> - 2014-08-23 22:12 -0400
          Re: local constants with switch Jim Gibson <jimsgibson@gmail.com> - 2014-08-21 17:04 -0700
            [OT] Re: local constants with switch Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-21 20:50 -0400
              Re: [OT] Re: local constants with switch Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-22 11:48 +0000
  Re: local constants with switch Joerg Meier <joergmmeier@arcor.de> - 2014-08-16 01:18 +0200
    Re: local constants with switch Arne Vajhøj <arne@vajhoej.dk> - 2014-08-15 22:44 -0400
      Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-16 09:01 +0000
        Re: local constants with switch Joerg Meier <joergmmeier@arcor.de> - 2014-08-16 12:08 +0200
        Re: local constants with switch Arne Vajhøj <arne@vajhoej.dk> - 2014-08-16 20:39 -0400
          Re: local constants with switch Joerg Meier <joergmmeier@arcor.de> - 2014-08-17 13:08 +0200
      Re: local constants with switch Joerg Meier <joergmmeier@arcor.de> - 2014-08-16 12:07 +0200
  Re: local constants with switch Arne Vajhøj <arne@vajhoej.dk> - 2014-08-15 22:42 -0400
    Re: local constants with switch Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-16 09:17 +0000

csiph-web