<commit_before>/**
 * A channel that is always on and always immediately acknowledges changes
 */
package com.simperium.tests.mock;

import com.simperium.client.Bucket;
import com.simperium.client.Bucket.ChannelProvider;
import com.simperium.client.Syncable;
import com.simperium.client.Change;
import com.simperium.client.RemoteChange;
import com.simperium.client.RemoteChangeInvalidException;
import com.simperium.util.Uuid;

import java.util.List;
import java.util.ArrayList;

public class MockChannel<T extends Syncable> implements ChannelProvider<T> {

    private Bucket<T> mBucket;

    public MockChannel(Bucket<T> bucket){
        mBucket = bucket;
    }

    @Override
    public Change<T> queueLocalDeletion(T object){
        Change<T> change = new Change<T>(Change.OPERATION_REMOVE, object);
        try {
            acknowledge(change);
        } catch (RemoteChangeInvalidException e) {
            throw( new RuntimeException(e));
        }
        return change;
    }

    @Override
    public Change<T> queueLocalChange(T object) {
        Change<T> change = new Change<T>(Change.OPERATION_MODIFY, object);
        try {
            acknowledge(change);            
        } catch (RemoteChangeInvalidException e) {
            throw(new RuntimeException(e));
        }
        return change;
    }

    @Override
    public void reset(){}

    @Override
    public void start(){}

    @Override
    public boolean isIdle(){
        return true;
    }<commit_msg>MockChannel now recognizes if it has been started or not<commit_after>/**
 * A channel that is always on and always immediately acknowledges changes
 */
package com.simperium.tests.mock;

import com.simperium.client.Bucket;
import com.simperium.client.Bucket.ChannelProvider;
import com.simperium.client.Syncable;
import com.simperium.client.Change;
import com.simperium.client.RemoteChange;
import com.simperium.client.RemoteChangeInvalidException;
import com.simperium.util.Uuid;

import java.util.List;
import java.util.ArrayList;

public class MockChannel<T extends Syncable> implements ChannelProvider<T> {

    private Bucket<T> mBucket;
    private boolean started = false;

    public MockChannel(Bucket<T> bucket){
        mBucket = bucket;
    }

    @Override
    public Change<T> queueLocalDeletion(T object){
        Change<T> change = new Change<T>(Change.OPERATION_REMOVE, object);
        try {
            if(started) acknowledge(change);
        } catch (RemoteChangeInvalidException e) {
            throw( new RuntimeException(e));
        }
        return change;
    }

    @Override
    public Change<T> queueLocalChange(T object) {
        Change<T> change = new Change<T>(Change.OPERATION_MODIFY, object);
        try {
            if(started) acknowledge(change);
        } catch (RemoteChangeInvalidException e) {
            throw(new RuntimeException(e));
        }
        return change;
    }

    @Override
    public void reset(){}

    @Override
    public void start(){
        started = true;
    }

    @Override
    public boolean isIdle(){
        return true;
    }
{'fraction_non_alphanumeric': 0.09582389122693429, 'fraction_numerical': 0.0, 'mean_word_length': 2.906447534766119, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4939017', 'n_tokens_mistral': 881, 'n_tokens_neox': 860, 'n_words': 217}