Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

switch case question
Hi,

Will the code below work as:" if devFaultType is equal to
RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR or
RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD or ...
RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT then set result equals true?".

//M

switch(devFaultType)
{
case RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR:
case RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD:
case RbsTypes.RBS_DEV_FAULT_TOO_LOW_PRIO_LOAD:
case RbsTypes.RBS_DEV_FAULT_TOO_HIGH_MAIN_LOAD:
case RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT:
result=true;
break;
default:
....
}


Report this thread to moderator Post Follow-up to this message
Old Post
Petterson Mikael
09-23-04 08:56 AM


Re: switch case question

"Petterson Mikael" <mikael.petterson@ericsson.se> wrote in message
news:41527AF6.7060009@ericsson.se...
> Hi,
>
> Will the code below work as:" if devFaultType is equal to
> RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR or
> RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD or ...
> RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT then set result equals true?".
>
> //M
>
> switch(devFaultType)
>         {
>           case RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR:
>           case RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD:
>           case RbsTypes.RBS_DEV_FAULT_TOO_LOW_PRIO_LOAD:
>           case RbsTypes.RBS_DEV_FAULT_TOO_HIGH_MAIN_LOAD:
>           case RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT:
>           result=true;
>                break;
>           default:
>            .....
>         }

It will return true for all the cases given except default.

--
Mike W



Report this thread to moderator Post Follow-up to this message
Old Post
VisionSet
09-23-04 08:56 AM


Re: switch case question
Petterson Mikael wrote:

> Hi,
>
> Will the code below work as:" if devFaultType is equal to
> RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR or
> RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD or ...
> RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT then set result equals true?".

What happened when you ran your code of which this this is an uncompilable
part? How can you hold the the opinion of some Usenet posters above what
your compiler tells you? If you really want our opinion, post a short,
complete, compilable, working example.

--
Paul Lutus
http://www.arachnoid.com


Report this thread to moderator Post Follow-up to this message
Old Post
Paul Lutus
09-23-04 01:57 PM


Re: switch case question
In article <41527AF6.7060009@ericsson.se>,
Petterson Mikael <mikael.petterson@ericsson.se> wrote:

> Hi,
>
> Will the code below work as:" if devFaultType is equal to
> RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR or
> RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD or ...
> RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT then set result equals true?".
>
> //M
>
> switch(devFaultType)
>         {
>           case RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR:
>           case RbsTypes.RBS_DEV_FAULT_TOO_LOW_MAIN_LOAD:
>           case RbsTypes.RBS_DEV_FAULT_TOO_LOW_PRIO_LOAD:
>           case RbsTypes.RBS_DEV_FAULT_TOO_HIGH_MAIN_LOAD:
>           case RbsTypes.RBS_DEV_FAULT_TMP_SENSOR_FAULT:
>           	result=true;
>                	break;
>           default:
>            .....
>         }

If those constants are primitives, it should work.

--
|\/|  /|  |2  |<
mehaase(at)sas(dot)upenn(dot)edu

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Haase
09-23-04 01:57 PM


Re: switch case question
Petterson Mikael wrote:

> switch(devFaultType) {
>          case RbsTypes.RBS_DEV_FAULT_GENERAL_HW_ERROR:

IIRC you need tiger to use final values from other classes in a
switch/case statement.
Also note that those final values are compiled into the bytecode, so if
you ever change the those final values you need to recompile all classes
that use them.

Report this thread to moderator Post Follow-up to this message
Old Post
Thomas Schodt
09-23-04 01:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:14 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.