// Path: core/src/main/java/com/github/fhuss/kafka/streams/cep/core/nfa/DeweyVersion.java
// public class DeweyVersion {
// 
//     private static final String VERSION_RUN_SEP = "\\.";
// 
//     private int[] versions;
// 
//     public DeweyVersion() {}
// 
//     /**
//      * Creates a new {@link DeweyVersion} instance.
//      *
//      * @param run    the first version number.
//      */
//     public DeweyVersion(final int run) {
//         this(new int[]{run});
//     }
// 
//     /**
//      * Creates a new {@link DeweyVersion} from the specified string.
//      *
//      * @param version A string dewey version number.
//      */
//     public DeweyVersion(final String version) {
//         String[] integers = version.split(VERSION_RUN_SEP);
//         this.versions = new int[integers.length];
//         for(int i = 0; i < integers.length; i++)
//             this.versions[i] = Integer.parseInt(integers[i]);
//     }
// 
//     private DeweyVersion(int[] versions) {
//         this.versions = versions;
//     }
// 
//     public DeweyVersion addRun() {
//         return addRun(1);
//     }
// 
//     public DeweyVersion addRun(final int offset) {
//         int[] newDeweyNumber = Arrays.copyOf(versions, versions.length);
//         newDeweyNumber[versions.length - offset]++;
// 
//         return new DeweyVersion(newDeweyNumber);
//     }
// 
//     public int length() {
//         return this.versions.length;
//     }
// 
//     public boolean isCompatible(DeweyVersion that) {
//         if (this.length() > that.length()) {
//             // prefix case
//             for (int i = 0; i < that.length(); i++)
//                 if (this.versions[i] != that.versions[i])
//                     return false;
// 
//             return true;
//         } else if (this.length() == that.length()) {
//             // check init digits for equality
//             int lastIndex = length() - 1;
//             for (int i = 0; i < lastIndex; i++)
//                 if ( this.versions[i] != that.versions[i])
//                     return false;
// 
//             // check that the last digit is greater or equal
//             return this.versions[lastIndex] >= that.versions[lastIndex];
//         } else {
//             return false;
//         }
//     }
// 
//     public DeweyVersion addStage() {
//         return new DeweyVersion(Arrays.copyOf(this.versions, versions.length + 1));
//     }
// 
//     @Override
//     public String toString() {
//          return Arrays.stream(versions)
//                 .mapToObj(Integer::toString)
//                 .collect(Collectors.joining("."));
//     }
// }


import com.github.fhuss.kafka.streams.cep.core.nfa.DeweyVersion;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
    }

    public long incrementRefAndGet() {
        return this.refs.incrementAndGet();
    }

    public long decrementRefAndGet() {
        return this.refs.get() == 0 ? 0 : this.refs.decrementAndGet();
    }

    public long getTimestamp() {
        return timestamp;
    }

    public K getKey() {
        return key;
    }

    public V getValue() {
        return value;
    }

    void removePredecessor(Pointer pointer) {
        this.predecessors.remove(pointer);
    }

    public Collection<Pointer> getPredecessors() {
        return predecessors;
    }

// Path: core/src/main/java/com/github/fhuss/kafka/streams/cep/core/nfa/DeweyVersion.java
// public class DeweyVersion {
// 
//     private static final String VERSION_RUN_SEP = "\\.";
// 
//     private int[] versions;
// 
//     public DeweyVersion() {}
// 
//     /**
//      * Creates a new {@link DeweyVersion} instance.
//      *
//      * @param run    the first version number.
//      */
//     public DeweyVersion(final int run) {
//         this(new int[]{run});
//     }
// 
//     /**
//      * Creates a new {@link DeweyVersion} from the specified string.
//      *
//      * @param version A string dewey version number.
//      */
//     public DeweyVersion(final String version) {
//         String[] integers = version.split(VERSION_RUN_SEP);
//         this.versions = new int[integers.length];
//         for(int i = 0; i < integers.length; i++)
//             this.versions[i] = Integer.parseInt(integers[i]);
//     }
// 
//     private DeweyVersion(int[] versions) {
//         this.versions = versions;
//     }
// 
//     public DeweyVersion addRun() {
//         return addRun(1);
//     }
// 
//     public DeweyVersion addRun(final int offset) {
//         int[] newDeweyNumber = Arrays.copyOf(versions, versions.length);
//         newDeweyNumber[versions.length - offset]++;
// 
//         return new DeweyVersion(newDeweyNumber);
//     }
// 
//     public int length() {
//         return this.versions.length;
//     }
// 
//     public boolean isCompatible(DeweyVersion that) {
//         if (this.length() > that.length()) {
//             // prefix case
//             for (int i = 0; i < that.length(); i++)
//                 if (this.versions[i] != that.versions[i])
//                     return false;
// 
//             return true;
//         } else if (this.length() == that.length()) {
//             // check init digits for equality
//             int lastIndex = length() - 1;
//             for (int i = 0; i < lastIndex; i++)
//                 if ( this.versions[i] != that.versions[i])
//                     return false;
// 
//             // check that the last digit is greater or equal
//             return this.versions[lastIndex] >= that.versions[lastIndex];
//         } else {
//             return false;
//         }
//     }
// 
//     public DeweyVersion addStage() {
//         return new DeweyVersion(Arrays.copyOf(this.versions, versions.length + 1));
//     }
// 
//     @Override
//     public String toString() {
//          return Arrays.stream(versions)
//                 .mapToObj(Integer::toString)
//                 .collect(Collectors.joining("."));
//     }
// }


// Path: core/src/main/java/com/github/fhuss/kafka/streams/cep/core/state/internal/MatchedEvent.java
import com.github.fhuss.kafka.streams.cep.core.nfa.DeweyVersion;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;

    }

    public long incrementRefAndGet() {
        return this.refs.incrementAndGet();
    }

    public long decrementRefAndGet() {
        return this.refs.get() == 0 ? 0 : this.refs.decrementAndGet();
    }

    public long getTimestamp() {
        return timestamp;
    }

    public K getKey() {
        return key;
    }

    public V getValue() {
        return value;
    }

    void removePredecessor(Pointer pointer) {
        this.predecessors.remove(pointer);
    }

    public Collection<Pointer> getPredecessors() {
        return predecessors;
    }

    public Pointer getPointerByVersion(DeweyVersion version) {