<commit_before>package scheduler;

import os.OperatingSystem;
import readinstruction.ReadInstruction;

import java.util.LinkedList;
import java.util.Queue;

/**
 * Created by Karol on 2017-04-20.
 */
public class FcfsScheduler implements Scheduler {
    private Queue<ReadInstruction> waitingQueue;
    private OperatingSystem parentOs;

    public FcfsScheduler(){
        this.waitingQueue = new LinkedList<>();
    }

    @Override
    public void setOs(OperatingSystem parentOs) {
        this.parentOs = parentOs;
    }

    @Override
    public void push(ReadInstruction instruction) {
        this.waitingQueue.add(instruction);
    }

    @Override
    public String getName() {
        return null;
    }

    @Override
    public void update(int time) {

    }
}
<commit_msg>Implement update method in FcfsScheduler<commit_after>package scheduler;

import os.OperatingSystem;
import readinstruction.ReadInstruction;

import java.util.LinkedList;
import java.util.Queue;

/**
 * Created by Karol on 2017-04-20.
 */
public class FcfsScheduler implements Scheduler {
    private Queue<ReadInstruction> waitingQueue;
    private OperatingSystem parentOs;
    private int headPosition;

    public FcfsScheduler(){
        this.waitingQueue = new LinkedList<>();
        this.headPosition = 0;
    }

    @Override
    public void setOs(OperatingSystem parentOs) {
        this.parentOs = parentOs;
    }

    @Override
    public void push(ReadInstruction instruction) {
        this.waitingQueue.add(instruction);
    }

    @Override
    public String getName() {
        return null;
    }

    @Override
    public void update(int time) {
        if (this.waitingQueue.peek().getReadAddress() > this.headPosition) this.headPosition++;
        if (this.waitingQueue.peek().getReadAddress() < this.headPosition) this.headPosition--;
        if (this.waitingQueue.peek().getReadAddress() == this.headPosition){
            this.waitingQueue.peek().read(time);
            this.parentOs.push(this.waitingQueue.remove());
        }
    }
}

{'fraction_non_alphanumeric': 0.09926650366748166, 'fraction_numerical': 0.008312958435207823, 'mean_word_length': 3.0514851485148515, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '4801951', 'n_tokens_mistral': 613, 'n_tokens_neox': 584, 'n_words': 132}