Tabnine Logo
org.apache.flink.cep.nfa
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.flink.cep.nfa

Best Java code snippets using org.apache.flink.cep.nfa (Showing top 20 results out of 315)

origin: apache/flink

@Override
public NFAState deserialize(DataInputView source) throws IOException {
  PriorityQueue<ComputationState> partialMatches = deserializeComputationStates(source);
  PriorityQueue<ComputationState> completedMatches = deserializeComputationStates(source);
  return new NFAState(partialMatches, completedMatches);
}
origin: apache/flink

@Override
public void serialize(NFAState record, DataOutputView target) throws IOException {
  serializeComputationStates(record.getPartialMatches(), target);
  serializeComputationStates(record.getCompletedMatches(), target);
}
origin: apache/flink

public static ComputationState createStartState(final String state) {
  return createStartState(state, new DeweyNumber(1));
}
origin: apache/flink

  @Override
  public void process(Object key, ValueState<MigratedNFA<IN>> state) throws Exception {
    MigratedNFA<IN> oldState = state.value();
    computationStates.update(new NFAState(oldState.getComputationStates()));
    org.apache.flink.cep.nfa.SharedBuffer<IN> sharedBuffer = oldState.getSharedBuffer();
    partialMatches.init(sharedBuffer.getEventsBuffer(), sharedBuffer.getPages());
    state.clear();
  }
}
origin: apache/flink

/**
 * Tear-down method for the NFA.
 */
public void close() throws Exception {
  for (State<T> state : getStates()) {
    for (StateTransition<T> transition : state.getStateTransitions()) {
      IterativeCondition condition = transition.getCondition();
      FunctionUtils.closeFunction(condition);
    }
  }
}
origin: apache/flink

private boolean isStartState(ComputationState state) {
  State<T> stateObject = getState(state);
  if (stateObject == null) {
    throw new FlinkRuntimeException("State " + state.getCurrentStateName() + " does not exist in the NFA. NFA has states "
      + states.values());
  }
  return stateObject.isStart();
}
origin: apache/flink

private boolean isFinalState(ComputationState state) {
  State<T> stateObject = getState(state);
  if (stateObject == null) {
    throw new FlinkRuntimeException("State " + state.getCurrentStateName() + " does not exist in the NFA. NFA has states "
      + states.values());
  }
  return stateObject.isFinal();
}
origin: apache/flink

  private boolean isSelfIgnore(final StateTransition<T> edge) {
    return isEquivalentState(edge.getTargetState(), currentState) &&
      edge.getAction() == StateTransitionAction.IGNORE;
  }
}
origin: apache/flink

void add(StateTransition<T> edge) {
  if (!isSelfIgnore(edge)) {
    if (edge.getAction() == StateTransitionAction.IGNORE) {
      totalIgnoreBranches++;
    } else if (edge.getAction() == StateTransitionAction.TAKE) {
      totalTakeBranches++;
    }
  }
  edges.add(edge);
}
origin: apache/flink

private boolean isStateTimedOut(final ComputationState state, final long timestamp) {
  return !isStartState(state) && windowTime > 0L && timestamp - state.getStartTimestamp() >= windowTime;
}
origin: apache/flink

  @Override
  public NFA<T> createNFA() {
    return new NFA<>(states, windowTime, timeoutHandling);
  }
}
origin: apache/flink

public NFASerializer(TypeSerializer<T> typeSerializer) {
  this(typeSerializer,
    new org.apache.flink.cep.nfa.SharedBuffer.SharedBufferSerializer<>(
      StringSerializer.INSTANCE,
      typeSerializer));
}
origin: apache/flink

  @Override
  protected NFAStateSerializer createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers) {

    @SuppressWarnings("unchecked")
    TypeSerializer<DeweyNumber> versionSerializer = (TypeSerializer<DeweyNumber>) nestedSerializers[0];

    @SuppressWarnings("unchecked")
    TypeSerializer<NodeId> nodeIdSerializer = (TypeSerializer<NodeId>) nestedSerializers[1];

    @SuppressWarnings("unchecked")
    TypeSerializer<EventId> eventIdSerializer = (TypeSerializer<EventId>) nestedSerializers[2];

    return new NFAStateSerializer(versionSerializer, nodeIdSerializer, eventIdSerializer);
  }
}
origin: apache/flink

@Override
public MigratedNFA<T> deserialize(
    MigratedNFA<T> reuse,
    DataInputView source) throws IOException {
  return deserialize(source);
}
origin: apache/flink

@Override
public TypeSerializerConfigSnapshot<SharedBuffer<V>> snapshotConfiguration() {
  return new SharedBufferSerializerConfigSnapshot<>(
    keySerializer,
    valueSerializer,
    versionSerializer);
}
origin: apache/flink

  public static ComputationState createState(
      final String currentState,
      final NodeId previousEntry,
      final DeweyNumber version,
      final long startTimestamp,
      final EventId startEventID) {
    return new ComputationState(currentState, previousEntry, version, startEventID, startTimestamp);
  }
}
origin: apache/flink

@Override
protected TypeSerializer<?>[] getNestedSerializers(NFAStateSerializer outerSerializer) {
  TypeSerializer<DeweyNumber> versionSerializer = outerSerializer.getVersionSerializer();
  TypeSerializer<NodeId> nodeIdSerializer = outerSerializer.getNodeIdSerializer();
  TypeSerializer<EventId> eventIdSerializer = outerSerializer.getEventIdSerializer();
  return new TypeSerializer[]{versionSerializer, nodeIdSerializer, eventIdSerializer};
}
origin: apache/flink

public NFA(
    final Collection<State<T>> validStates,
    final long windowTime,
    final boolean handleTimeout) {
  this.windowTime = windowTime;
  this.handleTimeout = handleTimeout;
  this.states = loadStates(validStates);
}
origin: apache/flink

@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
  copyStates(source, target); // copy partial matches
  copyStates(source, target); // copy completed matches
}
origin: apache/flink

@Override
public NFAState copy(NFAState from, NFAState reuse) {
  return copy(from);
}
org.apache.flink.cep.nfa

Most used classes

  • ComputationState
    Helper class which encapsulates the state of the NFA computation. It points to the current state, th
  • DeweyNumber
    Versioning scheme which allows to retrieve dependencies between different versions. A dewey number c
  • NFA
    Non-deterministic finite automaton implementation.The AbstractKeyedCEPPatternOperatorkeeps one NFA p
  • State
    Represents a state of the NFA. Each state is identified by a name and a state type. Furthermore, it
  • StateTransition
    Represents a transition from one State to another.
  • NFACompiler$NFAFactoryCompiler,
  • NFACompiler,
  • DeweyNumber$DeweyNumberSerializer,
  • NFA$NFASerializer,
  • NFA$NFASerializerConfigSnapshot,
  • NFA$OutgoingEdges,
  • NFAState,
  • NFAStateSerializer,
  • SharedBuffer$SharedBufferSerializer,
  • SharedBuffer$SharedBufferSerializerConfigSnapshot,
  • SharedBuffer$ValueTimeWrapper,
  • SharedBuffer,
  • AfterMatchSkipStrategy,
  • SkipToFirstStrategy
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