Tabnine Logo
Xor
Code IndexAdd Tabnine to your IDE (free)

How to use
Xor
in
cascading.operation.filter

Best Java code snippets using cascading.operation.filter.Xor (Showing top 5 results out of 315)

origin: cwensel/cascading

@Test
public void testXor()
 {
 Fields[] fields = new Fields[]{new Fields( 0 ), new Fields( 1 )};
 Filter[] filters = new Filter[]{new BooleanFilter( true ), new BooleanFilter( true )};
 Filter filter = new Xor( fields[ 0 ], filters[ 0 ], fields[ 1 ], filters[ 1 ] );
 assertFalse( invokeFilter( filter, new Tuple( 1, 2 ) ) );
 filters = new Filter[]{new BooleanFilter( true ), new BooleanFilter( false )};
 filter = new Xor( fields[ 0 ], filters[ 0 ], fields[ 1 ], filters[ 1 ] );
 assertTrue( invokeFilter( filter, new Tuple( 1, 2 ) ) );
 filters = new Filter[]{new BooleanFilter( false ), new BooleanFilter( true )};
 filter = new Xor( fields[ 0 ], filters[ 0 ], fields[ 1 ], filters[ 1 ] );
 assertTrue( invokeFilter( filter, new Tuple( 1, 2 ) ) );
 filters = new Filter[]{new BooleanFilter( false ), new BooleanFilter( false )};
 filter = new Xor( fields[ 0 ], filters[ 0 ], fields[ 1 ], filters[ 1 ] );
 assertFalse( invokeFilter( filter, new Tuple( 1, 2 ) ) );
 }
origin: cwensel/cascading

@Test
public void testComplexLogicXor() throws Exception
 {
 copyFromLocal( inputFileLhs );
 Tap source = getPlatform().getDelimitedFile( new Fields( "num", "char" ), " ", inputFileLhs );
 Pipe pipe = new Pipe( "test" );
 Filter filter = new Not( new Xor( new Fields( "num" ), new RegexFilter( "1", true, true ), new Fields( "char" ), new RegexFilter( "a", true, true ) ) );
 // compounding the filter for the Fields.ALL case.
 pipe = new Each( pipe, filter );
 pipe = new Each( pipe, new Fields( "num", "char" ), filter );
 Tap sink = getPlatform().getDelimitedFile( Fields.ALL, " ", getOutputPath( "/regression/complexlogicxor" ), SinkMode.REPLACE );
 Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
 flow.complete();
 validateLength( flow, 3, 2, Pattern.compile( "(1\t.)|(.\ta)" ) );
 }
origin: cascading/cascading-platform

@Test
public void testComplexLogicXor() throws Exception
 {
 copyFromLocal( inputFileLhs );
 Tap source = getPlatform().getDelimitedFile( new Fields( "num", "char" ), " ", inputFileLhs );
 Pipe pipe = new Pipe( "test" );
 Filter filter = new Not( new Xor( new Fields( "num" ), new RegexFilter( "1", true, true ), new Fields( "char" ), new RegexFilter( "a", true, true ) ) );
 // compounding the filter for the Fields.ALL case.
 pipe = new Each( pipe, filter );
 pipe = new Each( pipe, new Fields( "num", "char" ), filter );
 Tap sink = getPlatform().getDelimitedFile( Fields.ALL, " ", getOutputPath( "/regression/complexlogicxor" ), SinkMode.REPLACE );
 Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
 flow.complete();
 validateLength( flow, 3, 2, Pattern.compile( "(1\t.)|(.\ta)" ) );
 }
origin: cwensel/cascading

@Test
public void testXorExpression()
 {
 Fields inputFields = new Fields( "a", "b" );
 ExpressionFilter f1 = new ExpressionFilter( "( 100f < a )", new String[]{"a"}, new Class<?>[]{Float.TYPE} );
 ExpressionFilter f2 = new ExpressionFilter( "( 100f < b )", new String[]{"b"}, new Class<?>[]{Float.TYPE} );
 Xor logic = new Xor( new Fields( "a" ), f1, new Fields( "b" ), f2 );
 boolean[] results = invokeFilter( logic,
  new TupleEntry[]{
   new TupleEntry( inputFields, new Tuple( "1", "10" ) ),
   new TupleEntry( inputFields, new Tuple( "2", "20" ) )
  } );
 assertFalse( results[ 0 ] );
 assertFalse( results[ 1 ] );
 }
origin: cascading/cascading-expression

@Test
public void testXorExpression()
 {
 Fields inputFields = new Fields( "a", "b" );
 ExpressionFilter f1 = new ExpressionFilter( "( 100f < a )", new String[]{"a"}, new Class<?>[]{Float.TYPE} );
 ExpressionFilter f2 = new ExpressionFilter( "( 100f < b )", new String[]{"b"}, new Class<?>[]{Float.TYPE} );
 Xor logic = new Xor( new Fields( "a" ), f1, new Fields( "b" ), f2 );
 boolean[] results = invokeFilter( logic,
  new TupleEntry[]{
   new TupleEntry( inputFields, new Tuple( "1", "10" ) ),
   new TupleEntry( inputFields, new Tuple( "2", "20" ) )
  } );
 assertFalse( results[ 0 ] );
 assertFalse( results[ 1 ] );
 }
cascading.operation.filterXor

Javadoc

Class Xor is a Filter class that will logically 'xor' (exclusive or) the results of the constructor provided Filter instances.

Logically, if Filter#isRemove(cascading.flow.FlowProcess,cascading.operation.FilterCall) returns true for all given instances, or returns false for all given instances, this filter will return false.

Note that Xor can only be applied to two values.

Most used methods

  • <init>
    Constructor Xor creates a new Xor instance where all Filter instances receive all arguments.

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • compareTo (BigDecimal)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Option (scala)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now