@Override public BigInteger getBigInteger() { return get() ? BigInteger.ONE : BigInteger.ZERO; }
@Override public void set( final BoolType c ) { value = c.get(); }
@Override public long getIntegerLong() { return get() ? 1 : 0; }
@Override public long getIntegerLong() { return get() ? 1 : 0; }
@Override public BigInteger getBigInteger() { return get() ? BigInteger.ONE : BigInteger.ZERO; }
@Override public int getInteger() { return get() ? 1 : 0; }
@Override public void set( final BoolType c ) { value = c.get(); }
@Override public int getInteger() { return get() ? 1 : 0; }
@Override public int hashCode() { return Boolean.hashCode( get() ); } }
@Override public int hashCode() { return Boolean.hashCode( get() ); } }
public void fwd() { while ( c.hasNext() ) { c.fwd(); a.setPosition( c ); if ( a.get().get() ) { valid = true; return; } } valid = false; }
@Test public void test() { final FunctionRandomAccessible< BoolType > function = new FunctionRandomAccessible< BoolType >( 4, (pos, val) -> val.set( pos.getDoublePosition(0) > 0 && pos.getDoublePosition(1) > 1 && pos.getDoublePosition(2) > 2 && pos.getDoublePosition(3) > 3 ), BoolType::new ); FunctionRandomAccessible<BoolType>.FunctionRandomAccess access = function.randomAccess(); access.setPosition( new long[] {1, 2, 3, 4} ); assertTrue( access.get().get() ); access.setPosition( new long[] {0, 2, 3, 4} ); assertTrue( !access.get().get() ); access.setPosition( new long[] {1, 0, 3, 4} ); assertTrue( !access.get().get() ); access.setPosition( new long[] {1, 2, -10, 4} ); assertTrue( !access.get().get() ); access.setPosition( new long[] {10, 50, 5, 5} ); assertTrue( access.get().get() ); }
@Test public void test() { final FunctionRealRandomAccessible< BoolType > function = new FunctionRealRandomAccessible< BoolType >( 4, (pos, val) -> val.set( pos.getDoublePosition(0) > 0 && pos.getDoublePosition(1) > 1 && pos.getDoublePosition(2) > 2 && pos.getDoublePosition(3) > 3 ), BoolType::new ); FunctionRealRandomAccessible<BoolType>.RealFunctionRealRandomAccess access = function.realRandomAccess(); access.setPosition( new double[] {1, 2, 3, 4} ); assertTrue( access.get().get() ); access.setPosition( new double[] {0, 2, 3, 4} ); assertTrue( !access.get().get() ); access.setPosition( new double[] {1, 0, 3, 4} ); assertTrue( !access.get().get() ); access.setPosition( new double[] {1, 2, -10, 4} ); assertTrue( !access.get().get() ); access.setPosition( new double[] {10, 50, 5, 5} ); assertTrue( access.get().get() ); }