📄 hdate.java
字号:
package HECore.stddata;
import java.lang.*;
import java.util.*;
import HPCore.Exception.*;
public class HDate implements Cloneable
{
private double value;
/**
* Constructs a newly allocated HDate object that represents
* the primitive double argument.
*/
public HDate(double val){
this.value=val;
}
public Object clone()
{
try
{
HDate e = (HDate)super.clone();
return e;
} catch (CloneNotSupportedException e)
{
return null;
}
}
/**
*Returns the int value representaion of the HDate object.
*/
public short intValue()
{
return (new Double(value)).shortValue();
}
/**
*Returns the double value representaion of the HDate object.
*/
public double dblValue()
{
return value;
}
/**
*Returns the boolean value representaion of the HDate object.
*/
public boolean boolValue()
{
if(value != 0)
return true;
return false;
}
/**
*Returns the string value representaion of the HDate object.
*/
public String toString()
{
try{
String date_str=convert.dbl2datestr(value);
return date_str;
}catch(HpException e){;}
return null;
}
/**
*Returns the string value representaion of the HDate object.
*/
public String strValue() throws HpException
{
String datestr=convert.dbl2datestr(value);
return datestr;
}
/**
*Returns the byte value representaion of the HDate object.
*/
public short byteValue()
{
return (new Double(value)).shortValue();
}
/**
*Returns the single value representaion of the HDate object.
*/
public float sglValue()
{
return (new Double(value)).floatValue();
}
/**
*Returns the long value represention of the HDate object.
*/
public int lngValue()
{
return (new Double(value)).intValue();
}
/**
*Returns the Currency value represention of the HData object.
*/
public HCurr currValue()
{
return new HCurr(value);
}
/**
*Used to perform a arithmetical addition operation on two expressions.
*Return type is Date.
*/
public HDate Add(HDate b)
{
double val = this.value + b.dblValue();
HDate result = new HDate(val);
return result;
}
/**
*Used to perform a arithmetical subtraction operation on two expressions.
*Return type is Date.
*/
public double Sub(HDate b)
{
double result = this.value - b.dblValue();
return result;
}
public HDate Sub(double b)
{
double db=this.value-b;
return new HDate(db);
}
/**
*Used to perform a arithmetical multiplication operation on two expressions.
*Return type is double.
*/
public double Mul(HDate b)
{
double result = this.value * b.dblValue();
return result;
}
/**
*Used to perform a arithmetical division operation on two expressions.
*Return type is double.
*/
public double Div(HDate 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(HDate 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(HDate 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(HDate 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(HDate b) throws HpException
{
String avalue=new HDate(value).strValue();
String result=avalue +b.toString();
return result;
}
public boolean Like(HDate date2,boolean mode) throws HpException
{
return Operator.Like(this.toString(),date2.toString(),mode);
}
/**
*Used to perform a logical conjunction on two Numbers.
*Return type is int.(VB'S long type).
*/
public int And(HDate 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(HDate 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(HDate b) //retun type is long(vb)
{
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(HDate 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(HDate b)
{
//value = ((double)(~(a.lngValue() ^ b.lngValue())));
int result=(~((int)this.value) ^ b.lngValue());
return result;
}
public boolean Great(HDate b) {
double dvalue=b.dblValue();
if(this.value > dvalue)
return true;
else
return false;
}
public boolean Less(HDate b) {
double dvalue = b.dblValue();
if(this.value<dvalue)
return true;
else
return false;
}
public boolean Equal(HDate b) {
double dvalue = b.dblValue();
if(this.value==dvalue)
return true;
else
return false;
}
public boolean GreatEqual(HDate b) {
double dvalue = b.dblValue();
if(this.value >= dvalue)
return true;
else
return false;
}
public boolean LessEqual(HDate b) {
double dvalue = b.dblValue();
if(this.value <= dvalue)
return true;
else
return false;
}
public boolean NotEqual(HDate b) {
double dvalue = b.dblValue();
if(this.value != dvalue)
return true;
else
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -