package com.sine_x.regexp.state;

import com.google.common.collect.RangeSet;

public class CharClassState extends State {

    private boolean complement = false;
    private RangeSet<Character> set;

    public CharClassState(RangeSet<Character> set) {
        this(set, false);
    }

    public CharClassState(RangeSet<Character> set, boolean complement) {
        this.set = set;
        this.complement = complement;
    }

    @Override
    public boolean match(char c) {
        return complement ^ set.contains(c);
    }

    @Override
    public String toString() {
        return String.format("CharClassState(%s,%b)@%x", set, complement, hashCode());
    }
}

@@ -120,48 +120,8 @@
  %7B%0A%0A
-    private boolean complement = false;%0A
     
@@ -223,161 +223,17 @@
 this
-(set, false);%0A    %7D%0A%0A    public CharClassState(RangeSet%3CCharacter%3E set, boolean complement) %7B%0A        this.set = set;%0A        this.complement = complemen
+.set = se
 t;%0A 
@@ -305,21 +305,8 @@
 turn
- complement %5E
  set
@@ -422,11 +422,8 @@
 e(%25s
-,%25b
 )@%25x
@@ -433,20 +433,8 @@
 set,
- complement,
  has

Drop component bit