// Path: situation-model/src/main/java/br/ufes/inf/lprm/situation/model/Situation.java
// public interface Situation {
// 
//     public long getUID();
//     public SituationEvent getActivation();
//     public SituationEvent getDeactivation();
//     public void setDeactivation(SituationEvent deactivation);
//     public boolean isActive();
//     public List<? extends Participation> getParticipations();
//     public SituationType getType();
// }


import br.ufes.inf.lprm.situation.model.Situation;
import org.drools.core.base.ValueType;
import org.drools.core.base.evaluators.MeetsEvaluatorDefinition;
import org.drools.core.common.EventFactHandle;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.rule.VariableRestriction.VariableContextEntry;
import org.drools.core.rule.VariableRestriction.LeftStartRightEndContextEntry;
import org.drools.core.spi.FieldValue;
import org.drools.core.spi.InternalReadAccessor;
import java.lang.reflect.Field;
            Situation sit = (Situation) right.getObject();
            rightEndTS   = !sit.isActive() ? sit.getDeactivation().getTimestamp() : Long.MAX_VALUE;
        } else {
            rightEndTS = ((EventFactHandle) right).getEndTimestamp();
        }

        long dist = Math.abs( leftStartTS - rightEndTS );
        return this.getOperator().isNegated() ^ (dist <= this.finalRange);
    }

    public boolean evaluate(InternalWorkingMemory workingMemory,
                            final InternalReadAccessor leftExtractor,
                            final InternalFactHandle left,
                            final InternalReadAccessor rightExtractor,
                            final InternalFactHandle right) {

        if ( leftExtractor.isNullValue( workingMemory, left.getObject() ) ||
                rightExtractor.isNullValue( workingMemory, right.getObject() ) ) {
            return false;
        }

        long leftEndTS, rightStartTS;

        if (left.getObject() instanceof Situation) {
            Situation sit = (Situation) left.getObject();
            leftEndTS = sit.getDeactivation().getTimestamp();
        }
        else leftEndTS = ((EventFactHandle) left).getEndTimestamp();

        if (right.getObject() instanceof Situation) {
// Path: situation-model/src/main/java/br/ufes/inf/lprm/situation/model/Situation.java
// public interface Situation {
// 
//     public long getUID();
//     public SituationEvent getActivation();
//     public SituationEvent getDeactivation();
//     public void setDeactivation(SituationEvent deactivation);
//     public boolean isActive();
//     public List<? extends Participation> getParticipations();
//     public SituationType getType();
// }


// Path: scene-core/src/main/java/br/ufes/inf/lprm/scene/base/evaluators/implementation/MeetsEvaluator.java
import br.ufes.inf.lprm.situation.model.Situation;
import org.drools.core.base.ValueType;
import org.drools.core.base.evaluators.MeetsEvaluatorDefinition;
import org.drools.core.common.EventFactHandle;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.rule.VariableRestriction.VariableContextEntry;
import org.drools.core.rule.VariableRestriction.LeftStartRightEndContextEntry;
import org.drools.core.spi.FieldValue;
import org.drools.core.spi.InternalReadAccessor;
import java.lang.reflect.Field;

            Situation sit = (Situation) right.getObject();
            rightEndTS   = !sit.isActive() ? sit.getDeactivation().getTimestamp() : Long.MAX_VALUE;
        } else {
            rightEndTS = ((EventFactHandle) right).getEndTimestamp();
        }

        long dist = Math.abs( leftStartTS - rightEndTS );
        return this.getOperator().isNegated() ^ (dist <= this.finalRange);
    }

    public boolean evaluate(InternalWorkingMemory workingMemory,
                            final InternalReadAccessor leftExtractor,
                            final InternalFactHandle left,
                            final InternalReadAccessor rightExtractor,
                            final InternalFactHandle right) {

        if ( leftExtractor.isNullValue( workingMemory, left.getObject() ) ||
                rightExtractor.isNullValue( workingMemory, right.getObject() ) ) {
            return false;
        }

        long leftEndTS, rightStartTS;

        if (left.getObject() instanceof Situation) {
            Situation sit = (Situation) left.getObject();
            leftEndTS = sit.getDeactivation().getTimestamp();
        }
        else leftEndTS = ((EventFactHandle) left).getEndTimestamp();

        if (right.getObject() instanceof Situation) {
            Situation sit = (Situation) right.getObject();