public Value nvl( Value alt ) { if ( isNull() ) { setValue( alt ); } return this; }
public Value and( Value v ) { long n1 = getInteger(); long n2 = v.getInteger(); long res = n1 & n2; setValue( res ); return this; }
public Value bool_xor( Value v ) { boolean b1 = getBoolean(); boolean b2 = v.getBoolean(); boolean res = b1 && b2 ? false : !b1 && !b2 ? false : true; setValue( res ); return this; }
public Value bool_and( Value v ) { boolean b1 = getBoolean(); boolean b2 = v.getBoolean(); boolean res = b1 && b2; setValue( res ); return this; }
public Value or( Value v ) { long n1 = getInteger(); long n2 = v.getInteger(); long res = n1 | n2; setValue( res ); return this; }
public Value bool_or( Value v ) { boolean b1 = getBoolean(); boolean b2 = v.getBoolean(); boolean res = b1 || b2; setValue( res ); return this; }
public Value upper() { if ( isNull() ) { setType( VALUE_TYPE_STRING ); return this; } setValue( getString().toUpperCase() ); return this; }
public Value lower() { if ( isNull() ) { setType( VALUE_TYPE_STRING ); } else { setValue( getString().toLowerCase() ); } return this; }
public Value sqrt() throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.sqrt( getNumber() ) ); } else { throw new KettleValueException( "Function SQRT only works with a number" ); } return this; }
public Value tan() throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.tan( getNumber() ) ); } else { throw new KettleValueException( "Function TAN only works on a number" ); } return this; }
public Value acos() throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.acos( getNumber() ) ); } else { throw new KettleValueException( "Function ACOS only works with numeric data" ); } return this; }
public Value atan2( double arg0 ) throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.atan2( getNumber(), arg0 ) ); } else { throw new KettleValueException( "Function ATAN2 only works with numbers" ); } return this; }
public Value log() throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.log( getNumber() ) ); } else { throw new KettleValueException( "Function LOG only works with a number" ); } return this; }
public Value sin() throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.sin( getNumber() ) ); } else { throw new KettleValueException( "Function SIN only works with a number" ); } return this; }
public Value initcap() { if ( isNull() ) { return this; } if ( getString() == null ) { setNull(); } else { setValue( Const.initCap( getString() ) ); } return this; }
public Value replace( String repl, String with ) { if ( isNull() ) { return this; } if ( getString() == null ) { setNull(); } else { setValue( Const.replace( getString(), repl, with ) ); } return this; }
@Test public void jsToBigNumber_NativeJavaObject_BigDecimal() throws Exception { Value value = new Value(); value.setValue( BigDecimal.ONE ); Scriptable object = Context.toObject( value, scope ); assertEquals( 1.0, JavaScriptUtils.jsToBigNumber( object, JAVA_OBJECT ).doubleValue(), 1e-6 ); }