All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.event.ruler.Step Maven / Gradle / Ivy

Go to download

Event Ruler is a Java library that allows matching Rules to Events. An event is a list of fields, which may be given as name/value pairs or as a JSON object. A rule associates event field names with lists of possible values. There are two reasons to use Ruler: 1/ It's fast; the time it takes to match Events doesn't depend on the number of Rules. 2/ Customers like the JSON "query language" for expressing rules.

There is a newer version: 1.8.1
Show newest version
package software.amazon.event.ruler;

import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;
import java.util.Objects;
import java.util.Set;

/**
 * Represents a suggestion of a state/token combo from which there might be a transition.  The event token
 *  indexed is always the key of a key/value combination
 */
@Immutable
@ThreadSafe
class Step {
    final int keyIndex;
    final NameState nameState;
    final Set candidateSubRuleIds;

    Step(final int keyIndex, final NameState nameState, final Set candidateSubRuleIds) {
        this.keyIndex = keyIndex;
        this.nameState = nameState;
        this.candidateSubRuleIds = candidateSubRuleIds;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Step step = (Step) o;
        return  keyIndex == step.keyIndex &&
                Objects.equals(nameState, step.nameState) &&
                Objects.equals(candidateSubRuleIds, step.candidateSubRuleIds);
    }

    @Override
    public int hashCode() {
        return Objects.hash(keyIndex, nameState, candidateSubRuleIds);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy