📄 hcurr.java
字号:
package HECore.stddata;
import java.lang.*;
import HPCore.Exception.*;
public class HCurr implements Cloneable
{
private double value;
/**
* Constructs a newly allocated HCurr object that represents
* the primitive double argument.
*/
public HCurr(double val){
this.value=val;
}
public Object clone()
{
try
{
HCurr e = (HCurr)super.clone();
return e;
} catch (CloneNotSupportedException e)
{
return null;
}
}
/**
*Returns the int value representaion of the HCurr object.
*/
public short intValue()
{
return (new Double(value)).shortValue();
}
/**
*Returns the double value representaion of the HCurr object.
*/
public double dblValue()
{
return value;
}
/**
*Returns the boolean vlaue representaion of the HCurr object.
*/
public boolean boolValue()
{
if(value != 0)
return true;
return false;
}
/**
*Returns the String value representaion of the HCurr object.
*/
public String toString() {
return (new Double(value)).toString();
}
/**
*Returns the String value representaion of the HCurr object.
*/
public String strValue()
{
return (new Double(value)).toString();
}
/**
*Returns the byte value representaion of the HCurr object.
*/
public short byteValue()
{
return (new Double(value)).shortValue();
}
/**
*Returns the single value representaion of the HCurr object.
*/
public float sglValue()
{
return (new Double(value)).floatValue();
}
/**
*Returns the long value representaion of the HCurr object.
*/
public int lngValue()
{
return (new Double(value)).intValue();
}
/**
*Returns the date value representaion of the HCurr object.
*/
public HDate dateValue()
{
return (new HDate(value));
}
/**
*Used to perform an arithmetical addition operation on two expressions.
*Return type is currency.
*/
public HCurr Add(HCurr b)
{
double value = this.value + b.dblValue();
HCurr result = new HCurr(value);
return result;
}
/**
*Used to perform an arithmetical subtraction operation on two expressions.
*Return type is currency.
*/
public HCurr Sub(HCurr b)
{
double value = this.value - b.dblValue();
HCurr result = new HCurr(value);
return result;
}
/**
*Used to perform an arithmetical multiplication operation on two expressions.
*Return type is double.
*/
public HCurr Mul(HCurr b)
{
double result = this.value * b.dblValue();
return new HCurr(result);
}
/**
*Used to perform an arithmetical division operation on two expressions.
*Return type is double.
*/
public double Div(HCurr b) throws HpException
{
if(b.value ==0.0)
throw new HpException(11,"Division by Zero");
double result = (this.value / b.dblValue());
return result;
}
/**
*Used to divide two numbers and return an integer result.
*Return type is int.(VB'S long type)
*/
public int Ddiv(HCurr b) throws HpException
{
if(b.value ==0.0)
throw new HpException(11,"Division by Zero");
int result =(int)(this.value / b.dblValue());
return result;
}
/**
*Used to raise a number to the power of an exponent.
*Return type is double.
*/
public double Pow(HCurr b)
{
double result = (double)Math.pow(this.value,b.dblValue());
return result;
}
/**
*Used to divide two numbers and return only the remainder.
*Return type is int(VB'S long type).
*/
public int Mod(HCurr d) throws HpException
{
if(d.lngValue() ==0)
throw new HpException(11,"Division by Zero.");
int result =((int)this.value) % d.lngValue();
return result;
}
/**
*Used to force concatenation of two number
*Return type is String.
*/
public String Link(HCurr b)
{
String avalue=(new Double(value)).toString();
String result=avalue +b.toString();
return result;
}
public boolean Like(HCurr curr1,boolean mode) throws HpException
{
return Operator.Like(this.toString(),curr1.toString(),mode);
}
/**
*Used to perform a logical conjunction on two Numbers.
*Return type is int.(VB'S long type).
*/
public int And(HCurr b)
{
int result=(int)this.value & b.lngValue();
return result;
}
/**
*Used to perform a logical disjunction on two Numbers.
*Return type is int.(VB'S Long type).
*/
public int Or(HCurr b)
{
int result=((int)this.value | (int)b.dblValue());
return result;
}
/**
*Used to perform a logical exclusion on two Numbers
*Return type is int.(VB'S Long type)
*/
public int Xor(HCurr b)
{
int result = ((int)this.value ^ (int)b.dblValue());
return result;
}
/**
*Used to perform a logical implication on two numbers.
*Return type is int.(VB'S long type).
*/
public int Imp(HCurr b)
{
//value = ((double)(~(a.lngValue() & ~(b.lngValue()))));
int result =(int)(~((int)this.value) & ~(b.lngValue()));
return result;
}
/**
*Used to perform logical negation on an expression.
*Return type is int.
*/
public int Not()
{
int result = (~this.lngValue());
return result;
}
/**
*Used to perform a logical equivalence on two expressions.
*Return type is int.
*/
public int Eqv(HCurr b)
{
//value = ((double)(~(a.lngValue() ^ b.lngValue())));
int result=(~((int)this.value) ^ b.lngValue());
return result;
}
public boolean Great(HCurr b) {
double dvalue=b.dblValue();
if(this.value > dvalue)
return true;
else
return false;
}
public boolean Less(HCurr b) {
double dvalue = b.dblValue();
if(this.value<dvalue)
return true;
else
return false;
}
public boolean Equal(HCurr b) {
double dvalue = b.dblValue();
if(this.value==dvalue)
return true;
else
return false;
}
public boolean GreatEqual(HCurr b) {
double dvalue = b.dblValue();
if(this.value >= dvalue)
return true;
else
return false;
}
public boolean LessEqual(HCurr b) {
double dvalue = b.dblValue();
if(this.value <= dvalue)
return true;
else
return false;
}
public boolean NotEqual(HCurr b) {
double dvalue = b.dblValue();
if(this.value != dvalue)
return true;
else
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -