Package bg.smoc.model.GradeProto.Grade

Examples of bg.smoc.model.GradeProto.Grade.Builder


        // }
        os.flush();
    }

    private void sendProtobuf() throws AgentException, IOException {
        Builder protoBuilder = GradeProto.Grade.newBuilder();
        protoBuilder.setTaskName(currentJob.getTask());
        protoBuilder.setLanguage(currentJob.getLanguage());
        Task task = getTask();
        if (currentJob.getType() != JobType.TEST) {
            if (task.getType() == Task.PROBLEM_TYPE_OUTPUT) {
                try {
                    protoBuilder.addTestIndexes(Integer.parseInt(currentJob.getTestIndex()));
                } catch (NumberFormatException e) {
                    throw new AgentException("Invalid test index.");
                }
            } else {
                Contest contest = extractContest();
                protoBuilder.addAllTestIndexes(task.getTestIndexesByJobType(currentJob.getType(),
                        !currentJob.isNotGradeFeedback(),
                        contest.isFeedbackOn()));
            }
            for (BigDecimal points : task.getTestsPoints(protoBuilder.getTestIndexesList())) {
                protoBuilder.addMaxPoints(points.toString());
            }
        }
        protoBuilder.setExplicitGrade(currentJob.getType() == JobType.GRADE);
        protoBuilder.setTaskType(task.getType());
        protoBuilder.setTimeLimit(task.getTimeLimit());
        protoBuilder.setMemoryLimit(task.getMemoryLimit());
        protoBuilder.setOutputLimit(task.getOutputLimit());
        protoBuilder.setTestsCount(task.getNumberOfTests());

        Grade gradeProto = protoBuilder.build();
        DataOutputStream dataOutput = new DataOutputStream(os);
        dataOutput.writeInt(gradeProto.getSerializedSize());
        gradeProto.writeTo(dataOutput);
        // we will continue work with os, so do not close dataOutput.
    }
View Full Code Here

TOP

Related Classes of bg.smoc.model.GradeProto.Grade.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.