<commit_before>package perf.server.util;

import javax.ws.rs.core.Response;

/**
 * Created with IntelliJ IDEA.
 * User: nitinka
 * Date: 9/2/13
 * Time: 3:47 PM
 * To change this template use File | Settings | File Templates.
 */
public class ResponseBuilder {
    public static Response response(Response.Status status, Object message) {
        return Response.status(status).entity(message).build();
    }

    public static Response jobNotOver(String jobId) {
        return ResponseBuilder.response(Response.Status.BAD_REQUEST,
                String.format("{\"reason\" : \"Job %s Not Over Yet\"}", jobId));
    }

    public static Response jobNotFound(String jobId) {
        return ResponseBuilder.response(Response.Status.NOT_FOUND,
                String.format("{\"reason\" : \"Job %s doesn't exist\"}", jobId));
    }

    public static Response agentNotRegistered(String agentIp) {
        return ResponseBuilder.response(Response.Status.NOT_FOUND,
                String.format("{\"reason\" : \"Agent %s not registered yet\"}", agentIp));
    }

    public static Response runNameAlreadyExists(String runName) {
        return ResponseBuilder.response(Response.Status.CONFLICT,
                String.format("{\"reason\" : \"Run %s Already exists\"}", runName));
    }

    public static Response runNameDoesNotExist(String runName) {
        return ResponseBuilder.response(Response.Status.NOT_FOUND,
                String.format("{\"reason\" : \"Run %s Does Not exist\"}", runName));
    }
}
<commit_msg>Little Refactoring to ResponseBuilder class<commit_after>package perf.server.util;

import javax.ws.rs.core.Response;

/**
 * Created with IntelliJ IDEA.
 * User: nitinka
 * Date: 9/2/13
 * Time: 3:47 PM
 * To change this template use File | Settings | File Templates.
 */
public class ResponseBuilder {
    public static Response jobNotOver(String jobId) {
        return response(Response.Status.BAD_REQUEST,
                String.format("{\"reason\" : \"Job %s Not Over Yet\"}", jobId));
    }

    public static Response jobNotFound(String jobId) {
        return resourceNotFound("Job", jobId);
    }

    public static Response agentNotRegistered(String agentIp) {
        return resourceNotFound("Agent", agentIp);
    }

    public static Response runNameAlreadyExists(String runName) {
        return resourceAlreadyExists("Run", runName);
    }

    public static Response runNameDoesNotExist(String runName) {
        return resourceNotFound("Run", runName);
    }

    public static Response resourceAlreadyExists(String resourceType, String resourceName) {
        return response(Response.Status.NOT_FOUND,
                String.format("{\"reason\" : \"%s %s Already Exists\"}", resourceType, resourceName));
    }

    public static Response resourceNotFound(String resourceType, String resourceName) {
        return response(Response.Status.NOT_FOUND,
                String.format("{\"reason\" : \"%s %s Does Not exist\"}", resourceType, resourceName));
    }

    public static Response response(Response.Status status, Object message) {
        return Response.status(status).entity(message).build();
    }

}

{'fraction_non_alphanumeric': 0.11854199683042789, 'fraction_numerical': 0.0044374009508716325, 'mean_word_length': 3.1746031746031744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6125705', 'n_tokens_mistral': 876, 'n_tokens_neox': 845, 'n_words': 223}