473,394 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Boolean Value

281 100+
Good day all! I have one more question and needed some inputs
from you guys.

This is regarding condition value (T/F). My program (Driver) prints out condition values in reversed way - which means it supposed to print out 'false' but it's giving 'true' value and vice versa.
Please refer my Driver class (excerpt):
Expand|Select|Wrap|Line Numbers
  1. java.util.List ifs = new java.util.ArrayList();
  2.  
  3. Instruction insn = jvm.getLastInstruction();     
  4.  ……… 
  5.  ………
  6.    if (insn instanceof IfInstruction) 
  7. {
  8.      IfInstruction iff = (IfInstruction) insn;
  9.      Object position = insn.getOffset();
  10.      boolean value = iff.getConditionValue();   //THE PROBLEM IS HERE ***
  11.      ifs.add(new Entry(position, value));
  12.      System.out.print(value);
  13.      System.out.println();                                
  14. }
Here is the IfInstruction class where I need to get value (T/F) when it encounters IF* statements:
Expand|Select|Wrap|Line Numbers
  1.  
  2. int target; /** jump offset */
  3. boolean conditionValue;  /** value of last evaluation of branch condition */
  4. /**
  5.    * return which branch was taken. Only useful after instruction got executed
  6.    */
  7. public boolean getConditionValue() 
  8.   {
  9.      return conditionValue;       
  10.   }
So my idea is I have to consider reversing the condition so that true actually points to true and false points to false. What do you think? Please advise….many thanks

Shana
Feb 4 '07 #1
5 1623
r035198x
13,262 8TB
Good day all! I have one more question and needed some inputs
from you guys.

This is regarding condition value (T/F). My program (Driver) prints out condition values in reversed way - which means it supposed to print out 'false' but it's giving 'true' value and vice versa.
Please refer my Driver class (excerpt):
Expand|Select|Wrap|Line Numbers
  1. java.util.List ifs = new java.util.ArrayList();
  2.  
  3. Instruction insn = jvm.getLastInstruction(); 
  4. ……… 
  5. ………
  6. if (insn instanceof IfInstruction) 
  7. {
  8. IfInstruction iff = (IfInstruction) insn;
  9. Object position = insn.getOffset();
  10. boolean value = iff.getConditionValue(); //THE PROBLEM IS HERE ***
  11. ifs.add(new Entry(position, value));
  12. System.out.print(value);
  13. System.out.println(); 
  14. }
Here is the IfInstruction class where I need to get value (T/F) when it encounters IF* statements:
Expand|Select|Wrap|Line Numbers
  1.  
  2. int target; /** jump offset */
  3. boolean conditionValue; /** value of last evaluation of branch condition */
  4. /**
  5. * return which branch was taken. Only useful after instruction got executed
  6. */
  7. public boolean getConditionValue() 
  8. {
  9. return conditionValue; 
  10. }
So my idea is I have to consider reversing the condition so that true actually points to true and false points to false. What do you think? Please advise….many thanks

Shana
You can reverse the value of a boolean expression using the ! operator.
Feb 5 '07 #2
shana07
281 100+
Just this!
Expand|Select|Wrap|Line Numbers
  1. value = ! value;
phew! why I couldn't think about it :)
Thank u mode.
Shana
Feb 5 '07 #3
r035198x
13,262 8TB
Just this!

Expand|Select|Wrap|Line Numbers
  1. value = ! value;
phew! why I couldn\'t think about it [img][/img]

Thank u mode.

Shana


Please, PLEASE do not call me mode.
Feb 5 '07 #4
shana07
281 100+
Please, PLEASE do not call me mode.
So sorry. won't use the name next time.
again thanks.
Shana
Feb 5 '07 #5
r035198x
13,262 8TB
So sorry. won\'t use the name next time.

again thanks.

Shana


Some have even started calling me r0 (can you imagine).
Feb 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
15
by: F. Da Costa | last post by:
Hi all, Following two sniperts of code I'm using and getting very interesting results from. ..html <tr id="1" class="segment" open="false"> This is the segment under 'investigation' ..js
4
by: MLH | last post by:
The following function declaration confuses me... Public Function IsEMailAddress(ByVal sEmail As String, Optional ByRef sReason As String) As Boolean I tried pasting it and its code into an...
8
by: FrancisC | last post by:
how to define Boolean in C ? boolean abc; ??? is it default as True or False??
8
by: Metro Sauper | last post by:
Why is the default text representation for booleans in C# 'True' and 'False' whereas in xml it is 'true' and 'false'? It seems like it would make sense to have them both the same. Metro T....
10
by: Henri | last post by:
In java for instance there's a way to use booleans as objects and not as value types. I would like to do the same in VB.NET so that I can check if the boolean has been explicitely defined (is not...
4
by: Rich | last post by:
Dim bNcd, bNcm, bNqa, bNcur, bN0, bN1, bN2, bN3, bN4 As Boolean Dim arrBool As Boolean() = {bNcd, bNcm, bNqa, bNcur, bN0, bN1, bN2, bN3, bN4} Dim i As Integer bNcd = True bNcm = True bNqa =...
10
by: dba123 | last post by:
Why am I getting this error for Budget? Error: An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code Additional information: String was not...
2
by: John | last post by:
My application needs to call Oracle function using oracle client 9.2. The oracle function returns boolean value from its returned parameter. The name space that I used is system.data.oracleclient....
16
by: Shawnk | last post by:
I would like to perform various boolean operations on bitmapped (FlagsAttribute) enum types for a state machine design as in; ------------------- enum portState { Unknown, Open,
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.