@Override public BoolType copy() { return new BoolType( this ); }
@Override public void set( final BoolType c ) { value = c.get(); }
@Override public void setInteger( final int f ) { set( f >= 1 ); }
@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() ); }
private BoundaryRandomAccess4( final BoundaryRandomAccess4< T > ba ) { super( ba.source.copyRandomAccess() ); this.n = ba.n; this.min = ba.min; this.max = ba.max; this.type = ba.type.copy(); }
@Override public void or( final BoolType c ) { or( c.value ); }
@Override public void xor( final BoolType c ) { xor( c.value ); }
@Override public void and( final BoolType c ) { and( c.value ); }
@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() ); }
private BoundaryRandomAccess8( final BoundaryRandomAccess8< T > ba ) { super( ba.source.copyRandomAccess() ); this.n = ba.n; this.min = ba.min; this.max = ba.max; this.offsets = ba.offsets; this.resets = ba.resets; this.type = ba.type.copy(); }
@Override public void or( final BoolType c ) { or( c.value ); }
@Override public void xor( final BoolType c ) { xor( c.value ); }
@Override public void and( final BoolType c ) { and( c.value ); }
@Override public BoolType createVariable() { return new BoolType(); }
@Override public long getIntegerLong() { return get() ? 1 : 0; }
@Override public void setInteger( final long f ) { set( f >= 1 ); }
protected LabelRegionRandomAccess( final LabelRegionRandomAccess< T > a ) { super( a.numDimensions() ); source = a.source.copyRandomAccess(); type = a.type.copy(); label = a.label; offset = a.offset; tmp = new long[ n ]; }
@Override public BoolType createVariable() { return new BoolType(); }
@Override public long getIntegerLong() { return get() ? 1 : 0; }
@Override public void setInteger( final int f ) { set( f >= 1 ); }