Code Comments
Programming Forum and web based access to our favorite programming groups.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:
....
}
Post Follow-up to this message
"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
Post Follow-up to this messagePetterson 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
Post Follow-up to this messageIn 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
Post Follow-up to this messagePetterson 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.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.