class MovableChainedTrailingValueFilter<Solution_> implements SelectionFilter<Solution_, Object> {

    private final GenuineVariableDescriptor<Solution_> variableDescriptor;

    public MovableChainedTrailingValueFilter(GenuineVariableDescriptor<Solution_> variableDescriptor) {
        this.variableDescriptor = variableDescriptor;
    }

    @Override
    public boolean accept(ScoreDirector<Solution_> scoreDirector, Object value) {<FILL_FUNCTION_BODY>}

    private SingletonInverseVariableSupply retrieveSingletonInverseVariableSupply(ScoreDirector<Solution_> scoreDirector) {
        // TODO Performance loss because the supply is retrieved for every accept
        // A SelectionFilter should be optionally made aware of lifecycle events, so it can cache the supply
        SupplyManager supplyManager = ((InnerScoreDirector<Solution_, ?>) scoreDirector).getSupplyManager();
        return supplyManager.demand(new SingletonInverseVariableDemand<>(variableDescriptor));
    }

    @Override
    public boolean equals(Object other) {
        if (this == other)
            return true;
        if (other == null || getClass() != other.getClass())
            return false;
        MovableChainedTrailingValueFilter<?> that = (MovableChainedTrailingValueFilter<?>) other;
        return Objects.equals(variableDescriptor, that.variableDescriptor);
    }

    @Override
    public int hashCode() {
        return Objects.hash(variableDescriptor);
    }
}

        if (value == null) {
            return true;
        }
        SingletonInverseVariableSupply supply = retrieveSingletonInverseVariableSupply(scoreDirector);
        Object trailingEntity = supply.getInverseSingleton(value);
        EntityDescriptor<Solution_> entityDescriptor = variableDescriptor.getEntityDescriptor();
        if (trailingEntity == null || !entityDescriptor.matchesEntity(trailingEntity)) {
            return true;
        }
        return entityDescriptor.getEffectiveMovableEntitySelectionFilter().accept(scoreDirector, trailingEntity);
    
<no_super_class>