<commit_before>package org.ow2.proactive.scheduler.task;

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

import org.ow2.proactive.scheduler.common.task.TaskId;
import org.ow2.proactive.scheduler.common.task.TaskInfo;
import org.ow2.proactive.scheduler.common.task.TaskState;


public class ClientTaskState extends TaskState {

    private TaskInfo info;
    private int maxExecutionFailure;
    private int iterationIndex;
    private int replicationIndex;
    private List<TaskId> dependenceIds = new ArrayList<TaskId>();
    private List<TaskState> dependences = new ArrayList<TaskState>();

    public ClientTaskState(TaskState taskState) {
        //copy information from the TaskStae passed as an argument
        info = taskState.getTaskInfo();
        maxExecutionFailure = taskState.getMaxNumberOfExecutionOnFailure();
        iterationIndex = taskState.getIterationIndex();
        replicationIndex = taskState.getReplicationIndex();

        // Store only task IDs here; #restoreDependences is later called by
        // ClientJobState in order for this instance to store references to the
        // same ClientTaskState instances as the ones held in the
        // ClientJobState#tasks field.
        if (taskState.getDependences() != null) {
            for (TaskState dep : taskState.getDependences()) {
                dependenceIds.add(dep.getId());
            }
        }
    }

    @Override
    public void update(TaskInfo taskInfo) {
        info = taskInfo;
    }

    @Override
    public List<TaskState> getDependences() {
        return dependences;
    }

    @Override
    public TaskInfo getTaskInfo() {
        return info;
    }

    @Override
    public int getMaxNumberOfExecutionOnFailure() {
        return maxExecutionFailure;
    }

    @Override
    public TaskState replicate() throws Exception {
        throw new RuntimeException("Unsupported operation");
    }

    @Override
    public int getIterationIndex() {
        return iterationIndex;
    }

    @Override
    public int getReplicationIndex() {
        return replicationIndex;
    }

    public void restoreDependences(Map<TaskId, TaskState> tasksMap) {
        dependences.clear();
        for (TaskId id : dependenceIds) {
            dependences.add(tasksMap.get(id));
        }
    }
}<commit_msg>SCHEDULING-1485 * set task name in ClientTaskState * change variable names to match InternalTask so that JSON serialization is the same<commit_after>package org.ow2.proactive.scheduler.task;

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

import org.ow2.proactive.scheduler.common.task.TaskId;
import org.ow2.proactive.scheduler.common.task.TaskInfo;
import org.ow2.proactive.scheduler.common.task.TaskState;


public class ClientTaskState extends TaskState {

    private TaskInfo taskInfo;
    private int maxNumberOfExecutionOnFailure;
    private int iterationIndex;
    private int replicationIndex;
    private List<TaskId> dependenceIds = new ArrayList<TaskId>();
    private List<TaskState> dependences = new ArrayList<TaskState>();

    public ClientTaskState(TaskState taskState) {
        //copy information from the TaskStae passed as an argument
        taskInfo = taskState.getTaskInfo();
        maxNumberOfExecutionOnFailure = taskState.getMaxNumberOfExecutionOnFailure();
        iterationIndex = taskState.getIterationIndex();
        replicationIndex = taskState.getReplicationIndex();
        this.setName(taskState.getName());

        // Store only task IDs here; #restoreDependences is later called by
        // ClientJobState in order for this instance to store references to the
        // same ClientTaskState instances as the ones held in the
        // ClientJobState#tasks field.
        if (taskState.getDependences() != null) {
            for (TaskState dep : taskState.getDependences()) {
                dependenceIds.add(dep.getId());
            }
        }
    }

    @Override
    public void update(TaskInfo taskInfo) {
        taskInfo = taskInfo;
    }

    @Override
    public List<TaskState> getDependences() {
        return dependences;
    }

    @Override
    public TaskInfo getTaskInfo() {
        return taskInfo;
    }

    @Override
    public int getMaxNumberOfExecutionOnFailure() {
        return maxNumberOfExecutionOnFailure;
    }

    @Override
    public TaskState replicate() throws Exception {
        throw new RuntimeException("Unsupported operation");
    }

    @Override
    public int getIterationIndex() {
        return iterationIndex;
    }

    @Override
    public int getReplicationIndex() {
        return replicationIndex;
    }

    public void restoreDependences(Map<TaskId, TaskState> tasksMap) {
        dependences.clear();
        for (TaskId id : dependenceIds) {
            dependences.add(tasksMap.get(id));
        }
    }
}
{'fraction_non_alphanumeric': 0.08174163072499487, 'fraction_numerical': 0.0024645717806531116, 'mean_word_length': 2.9053728949478748, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2406158', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1276, 'n_words': 337}