Class Value
java.lang.Object
svm.value.Value
- Direct Known Subclasses:
BooleanValue, GeneralAddress, IntegerValue, LongRealValue, ObjectAddress, ProgramAddress, RealValue, RecordValue, RepetitionValue, StringValue, TextValue
Value.
value
::= boolean_value | character_value
::= integer_value | size_value
::= real_value | longreal_value
::= attribute_address | object_address
::= general_address | program_address
::= routine_address | record_value
Link to GitHub: Source File.
- Author:
- S-Port: Definition of S-code, Øystein Myhre Andersen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the result of: this value + other valueReturns the result of: this value and other valuebooleanCompare this Value with the given Value according to the given relation.copy()Returns a copy of this Value object.Returns the result of: this value / other valuevoidemit(DataSegment dseg) Add this value to the given DataSegmentReturns the result of: this value eqv other valueReturns the result of: this value imp other valueReturns the result of: this value * other valueneg()Returns the negative value of this Value object.Returns the result of: this value or other valuevoidUtility print method.static Valueread(int kind, AttributeInputStream inpt) Reads a Value of the given kind from the given input.static Valueread(AttributeInputStream inpt) Reads a Value from the given input.Returns the result of: this value rem other valueReturns the result of: this value shiftInstr other value S_LSHIFTA: Signed Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_LSHIFTL: Unsigned Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_RSHIFTA: Signed Right Shift >> The right shift operator moves all bits by a given number of bits to the right.Returns the result of: this value - other valuedoubletoDouble()Returns the double value of this Value object.floattoFloat()Returns the float value of this Value object.voidwrite(AttributeOutputStream oupt) Writes this Value to the given output.Returns the result of: this value xor other value
-
Field Details
-
type
The type of the value
-
-
Constructor Details
-
Value
public Value()Default Constructor
-
-
Method Details
-
print
Utility print method.- Parameters:
indent- number of spaces leading the lines
-
emit
Add this value to the given DataSegment- Parameters:
dseg- the DataSegment
-
toFloat
public float toFloat()Returns the float value of this Value object.- Returns:
- the float value of this Value object.
-
toDouble
public double toDouble()Returns the double value of this Value object.- Returns:
- the double value of this Value object.
-
copy
-
neg
Returns the negative value of this Value object.- Returns:
- the negative value of this Value object.
-
add
-
sub
-
mult
-
div
-
rem
-
and
-
or
-
xor
-
imp
-
eqv
-
compare
Compare this Value with the given Value according to the given relation.- Parameters:
relation- one of: LT, LE, EQ, GE, GT, NEother- the other Value- Returns:
- true: if the relation holds
-
shift
Returns the result of: this value shiftInstr other value S_LSHIFTA: Signed Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_LSHIFTL: Unsigned Left Shift << The left shift operator moves all bits by a given number of bits to the left. S_RSHIFTA: Signed Right Shift >> The right shift operator moves all bits by a given number of bits to the right. S_RSHIFTL: Unsigned Right Shift >>> It is the same as the signed right shift, but the vacant leftmost position is filled with 0 instead of the sign bit.- Parameters:
shiftInstr- the actual shift instructionother- the other value- Returns:
- the result of: this value shiftInstr other value
-
write
Writes this Value to the given output.- Parameters:
oupt- the output stream- Throws:
IOException- if IOException occur
-
read
Reads a Value from the given input.- Parameters:
inpt- the input stream- Returns:
- the Value read
- Throws:
IOException- if IOException occur
-
read
Reads a Value of the given kind from the given input.- Parameters:
kind- the value kindinpt- the input stream- Returns:
- the Value read
- Throws:
IOException- if IOException occur
-