Package cn.edu.zju.acm.onlinejudge.bean

Examples of cn.edu.zju.acm.onlinejudge.bean.Limit


            PreparedStatement ps = null;
            try {
                ps = conn.prepareStatement(ContestPersistenceImpl.SELECT_DEFAULT_LIMIT);
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    ContestPersistenceImpl.defaultLimit = new Limit();
                    ContestPersistenceImpl.defaultLimit.setId(rs.getLong(DatabaseConstants.LIMITS_LIMITS_ID));
                    ContestPersistenceImpl.defaultLimit
                                                       .setMemoryLimit(rs.getInt(DatabaseConstants.LIMITS_MEMORY_LIMIT));
                    ContestPersistenceImpl.defaultLimit
                                                       .setOutputLimit(rs.getInt(DatabaseConstants.LIMITS_OUTPUT_LIMIT));
View Full Code Here


        LimitForm limitForm = (LimitForm) form;

        if (limitForm.getId() == null || limitForm.getId().trim().length() == 0) {

            Limit limit = PersistenceManager.getInstance().getContestPersistence().getDefaultLimit();
            limitForm.setId("1");
            limitForm.setTimeLimit("" + limit.getTimeLimit());
            limitForm.setMemoryLimit("" + limit.getMemoryLimit());
            limitForm.setSubmissionLimit("" + limit.getSubmissionLimit());
            limitForm.setOutputLimit("" + limit.getOutputLimit());

            return this.handleSuccess(mapping, context, "failure");
        }

        Limit limit = new Limit();
        limit.setId(1);
        limit.setTimeLimit(Integer.parseInt(limitForm.getTimeLimit()));
        limit.setMemoryLimit(Integer.parseInt(limitForm.getMemoryLimit()));
        limit.setOutputLimit(Integer.parseInt(limitForm.getOutputLimit()));
        limit.setSubmissionLimit(Integer.parseInt(limitForm.getSubmissionLimit()));

        PersistenceManager.getInstance().getContestPersistence().updateDefaultLimit(limit);

        ActionMessages messages = new ActionMessages();
        messages.add("success", new ActionMessage("onlinejudge.DefaultLimit.success"));
View Full Code Here

        ReflectionUtil.setFieldValue(DAOFactory.class, "submissionDAO", new MockSubmissionDAO());
        ReflectionUtil.setFieldValue(DAOFactory.class, "referenceDAO", new MockReferenceDAO());
        Problem problem = new Problem();
        problem.setId(0);
        problem.setRevision(0);
        Limit limit = new Limit();
        limit.setTimeLimit(1);
        limit.setMemoryLimit(1024);
        limit.setOutputLimit(1);
        problem.setLimit(limit);
        Reference reference = new Reference();
        reference.setReferenceType(ReferenceType.INPUT);
        reference.setContent("0 0\n1 2\n2 3\n".getBytes("ASCII"));
        DAOFactory.getReferenceDAO().save(reference, 0);
View Full Code Here

  ReflectionUtil.setFieldValue(DAOFactory.class, "submissionDAO", new MockSubmissionDAO());
  ReflectionUtil.setFieldValue(DAOFactory.class, "referenceDAO", new MockReferenceDAO());
  Problem problem = new Problem();
  problem.setId(0);
  problem.setRevision(0);
  Limit limit = new Limit();
  limit.setTimeLimit(1);
  limit.setMemoryLimit(1024);
  limit.setOutputLimit(1);
  problem.setLimit(limit);
  Reference reference = new Reference();
  reference.setReferenceType(ReferenceType.INPUT);
  reference.setContent("0 0\n1 2\n2 3\n".getBytes("ASCII"));
  DAOFactory.getReferenceDAO().save(reference, 0);
View Full Code Here

        ret.setChecker(problem.isChecker());
        return ret;
    }

    private Limit cloneLimit(Limit limit) {
        Limit ret = new Limit();
        ret.setId(limit.getId());
        ret.setMemoryLimit(limit.getMemoryLimit());
        ret.setOutputLimit(limit.getOutputLimit());
        ret.setTimeLimit(limit.getTimeLimit());
        return ret;
    }
View Full Code Here

            submission.setJudgeComment(new String(bytes));
            return;
        } else if (reply != JudgeReply.READY.getId()) {
            throw new JudgeClientErrorException();
        }
        Limit limit = problem.getLimit();
        reply = this.sendTestcaseCommand(1, limit.getTimeLimit(), limit.getMemoryLimit(), limit.getOutputLimit());
        submission.setJudgeReply(JudgeReply.RUNNING);
        submission.setTimeConsumption(0);
        submission.setMemoryConsumption(0);
        while (reply == JudgeReply.RUNNING.getId()) {
            int timeConsumption = this.in.readInt();
View Full Code Here

            this.startTime = "";
            this.contestLength = "";
        }
        this.checkIp = contest.isCheckIp();

        Limit limit = contest.getLimit();
        this.useGlobalDefault = limit.getId() == Limit.DEFAULT_LIMIT_ID;
        this.timeLimit = String.valueOf(limit.getTimeLimit());
        this.memoryLimit = String.valueOf(limit.getMemoryLimit());
        this.submissionLimit = String.valueOf(limit.getSubmissionLimit());
        this.outputLimit = String.valueOf(limit.getOutputLimit());

        this.languageIds = new String[contest.getLanguages().size()];
        for (int i = 0; i < this.languageIds.length; ++i) {
            this.languageIds[i] = String.valueOf(contest.getLanguages().get(i).getId());
        }
View Full Code Here

        } catch (NumberFormatException e) {}

        contest.setTitle(this.name);
        contest.setDescription(this.description);
        contest.setCheckIp(this.checkIp);
        Limit limit = new Limit();
        if (this.useGlobalDefault) {
            limit.setId(1);
        } else {
            limit.setTimeLimit(Integer.parseInt(this.timeLimit));
            limit.setMemoryLimit(Integer.parseInt(this.memoryLimit));
            limit.setSubmissionLimit(Integer.parseInt(this.submissionLimit));
            limit.setOutputLimit(Integer.parseInt(this.outputLimit));
        }
        contest.setLimit(limit);
        contest.setForumId(Long.parseLong(this.forumId));

        List<Language> languages = new ArrayList<Language>();
View Full Code Here

   * Creates a new limit.
   * @param id the id
   * @return a new limit instance
   */
  private Limit newLimit(long id) {
    Limit limit = new Limit();
    limit.setId(id);
    limit.setTimeLimit((int) id * 10);
    limit.setMemoryLimit((int) id * 100);
    limit.setOutputLimit((int) id * 1000);
    limit.setSubmissionLimit((int) id * 10000);   
    return limit;
  }
View Full Code Here

        this.code = problem.getCode();
        this.author = problem.getAuthor();
        this.source = problem.getSource();
        this.contest = problem.getContest();
        this.specialJudge = problem.isChecker();
        Limit limit = problem.getLimit();
        this.useContestDefault = limit.getId() == contest.getLimit().getId();
        this.timeLimit = String.valueOf(limit.getTimeLimit());
        this.memoryLimit = String.valueOf(limit.getMemoryLimit());
        this.submissionLimit = String.valueOf(limit.getSubmissionLimit());
        this.outputLimit = String.valueOf(limit.getOutputLimit());
        this.color = problem.getColor();
        this.score = problem.getScore();

    }
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.bean.Limit

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.