2007-10-17 00:30:00 +00:00
|
|
|
/*
|
2007-11-03 23:35:00 +00:00
|
|
|
* $Id: Argument.java,v 1.8 2007/11/02 10:47:51 bacon Exp $
|
|
|
|
*
|
|
|
|
* {License}
|
2007-10-17 00:30:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
package ase.awk;
|
|
|
|
|
2007-11-03 23:35:00 +00:00
|
|
|
public class Argument implements Clearable
|
2007-10-17 00:30:00 +00:00
|
|
|
{
|
2007-10-19 14:05:00 +00:00
|
|
|
protected long runid;
|
2007-11-03 23:35:00 +00:00
|
|
|
//protected long valid;
|
|
|
|
public long valid;
|
2007-10-18 23:51:00 +00:00
|
|
|
|
2007-10-24 00:18:00 +00:00
|
|
|
/* An instance of the Argument class should not be used
|
|
|
|
* outside the context where it is availble. When it is
|
|
|
|
* referenced that way, the getXXX methods may cause
|
|
|
|
* JVM to crash */
|
|
|
|
|
2007-11-03 23:35:00 +00:00
|
|
|
Argument (Context ctx, long runid, long valid)
|
2007-10-18 23:51:00 +00:00
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (ctx != null) ctx.pushClearable (this);
|
2007-10-19 14:05:00 +00:00
|
|
|
this.runid = runid;
|
|
|
|
this.valid = valid;
|
2007-10-18 23:51:00 +00:00
|
|
|
}
|
|
|
|
|
2007-11-03 23:35:00 +00:00
|
|
|
Argument (long runid, long valid)
|
|
|
|
{
|
|
|
|
this (null, runid, valid);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void clear ()
|
|
|
|
{
|
|
|
|
clearval (this.runid, this.valid);
|
|
|
|
}
|
|
|
|
|
2007-10-20 00:02:00 +00:00
|
|
|
public long getIntValue ()
|
2007-10-18 23:51:00 +00:00
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (this.valid == 0) return 0;
|
2007-10-19 14:05:00 +00:00
|
|
|
return getintval (this.runid, this.valid);
|
2007-10-18 23:51:00 +00:00
|
|
|
}
|
|
|
|
|
2007-10-20 00:02:00 +00:00
|
|
|
public double getRealValue ()
|
2007-10-18 23:51:00 +00:00
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (this.valid == 0) return 0.0;
|
2007-10-19 14:05:00 +00:00
|
|
|
return getrealval (this.runid, this.valid);
|
2007-10-18 23:51:00 +00:00
|
|
|
}
|
|
|
|
|
2007-10-20 00:02:00 +00:00
|
|
|
public String getStringValue () throws Exception
|
2007-10-18 23:51:00 +00:00
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (this.valid == 0) return "";
|
2007-10-19 14:05:00 +00:00
|
|
|
return getstrval (this.runid, this.valid);
|
2007-10-18 23:51:00 +00:00
|
|
|
}
|
|
|
|
|
2007-10-21 00:06:00 +00:00
|
|
|
public boolean isIndexed ()
|
2007-10-18 23:51:00 +00:00
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (this.valid == 0) return false;
|
2007-10-21 00:06:00 +00:00
|
|
|
return isindexed (this.runid, this.valid);
|
2007-10-18 23:51:00 +00:00
|
|
|
}
|
|
|
|
|
2007-10-21 00:06:00 +00:00
|
|
|
public Argument getIndexed (String idx) throws Exception
|
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (this.valid == 0) return null;
|
2007-10-21 00:06:00 +00:00
|
|
|
return getindexed (this.runid, this.valid, idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Argument getIndexed (long idx) throws Exception
|
2007-10-18 23:51:00 +00:00
|
|
|
{
|
2007-11-03 23:35:00 +00:00
|
|
|
if (this.valid == 0) return null;
|
2007-10-18 23:51:00 +00:00
|
|
|
return getIndexed (Long.toString(idx));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected native long getintval (long runid, long valid);
|
|
|
|
protected native double getrealval (long runid, long valid);
|
2007-10-19 14:05:00 +00:00
|
|
|
protected native String getstrval (long runid, long valid) throws Exception;
|
2007-10-21 00:06:00 +00:00
|
|
|
protected native boolean isindexed (long runid, long valid);
|
|
|
|
protected native Argument getindexed (long runid, long valid, String idx) throws Exception;
|
2007-11-03 23:35:00 +00:00
|
|
|
|
|
|
|
protected native void clearval (long runid, long valid);
|
2007-10-17 00:30:00 +00:00
|
|
|
}
|