Examples of Limit


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

                long limitId = rs.getLong(DatabaseConstants.PROBLEM_LIMITS_ID);
                ps = conn.prepareStatement(ProblemPersistenceImpl.GET_LIMIT);
                ps.setLong(1, limitId);
                rs = ps.executeQuery();
                if (rs.next()) {
                    Limit limit = this.populateLimit(rs);
                    problem.setLimit(limit);
                }
                return problem;
            } finally {
                Database.dispose(ps);
View Full Code Here

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

     * @param rs
     * @return an Limit instance
     * @throws SQLException
     */
    private Limit populateLimit(ResultSet rs) throws SQLException {
        Limit limit = new Limit();
        limit.setId(rs.getLong(DatabaseConstants.LIMITS_LIMITS_ID));
        limit.setTimeLimit(rs.getInt(DatabaseConstants.LIMITS_TIME_LIMIT));
        limit.setMemoryLimit(rs.getInt(DatabaseConstants.LIMITS_MEMORY_LIMIT));
        limit.setSubmissionLimit(rs.getInt(DatabaseConstants.LIMITS_SUBMISSION_LIMIT));
        limit.setOutputLimit(rs.getInt(DatabaseConstants.LIMITS_OUTPUT_LIMIT));
        return limit;
    }
View Full Code Here

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

                ps = conn.prepareStatement(this.buildSearchQuery(criteria, offset, count));
                ResultSet rs = ps.executeQuery();
                List<Problem> problems = new ArrayList<Problem>();
                while (rs.next()) {
                    Problem problem = this.populateProblem(rs);
                    Limit limit = this.populateLimit(rs);
                    problem.setLimit(limit);
                    problems.add(problem);
                }
                return problems;
            } finally {
View Full Code Here

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

        Connection conn = null;
        try {
            conn = Database.createConnection();
            conn.setAutoCommit(false);
            PreparedStatement ps = null;
            Limit limit;
            try {
                long contestLimitId = ProblemPersistenceImpl.DEFAULT_LIMIT_ID;
                ps = conn.prepareStatement(ProblemPersistenceImpl.GET_CONTEST_LIMIT_ID);
                ps.setLong(1, problem.getContestId());
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    contestLimitId = rs.getLong(1);
                }
                limit = problem.getLimit();
                if (limit == null) {
                    limit = new Limit();
                    limit.setId(contestLimitId);
                    problem.setLimit(limit);
                }
                if (limit.getId() != contestLimitId) {
                    ps = conn.prepareStatement(ProblemPersistenceImpl.INSERT_LIMIT);
                    ps.setInt(1, limit.getTimeLimit());
                    ps.setInt(2, limit.getMemoryLimit());
                    ps.setInt(3, limit.getOutputLimit());
                    ps.setInt(4, limit.getSubmissionLimit());
                    ps.executeUpdate();
                    limit.setId(Database.getLastId(conn));
                }
            } finally {
                Database.dispose(ps);
            }
            try {
                // create the problem
                ps = conn.prepareStatement(ProblemPersistenceImpl.INSERT_PROBLEM);
                ps.setLong(1, problem.getContestId());
                ps.setString(2, problem.getTitle());
                ps.setString(3, problem.getCode());
                ps.setLong(4, limit.getId());
                ps.setString(5, problem.getAuthor());
                ps.setString(6, problem.getSource());
                ps.setString(7, problem.getContest());
                ps.setBoolean(8, problem.isChecker());
                ps.setInt(9, 0);
View Full Code Here

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

                }
            } finally {
                Database.dispose(ps);
            }
            // update a new limit
            Limit limit = problem.getLimit();
            if (limit.getId() != contestLimitId) {
                try {
                    ps = conn.prepareStatement(ProblemPersistenceImpl.INSERT_LIMIT);
                    ps.setInt(1, limit.getTimeLimit());
                    ps.setInt(2, limit.getMemoryLimit());
                    ps.setInt(3, limit.getOutputLimit());
                    ps.setInt(4, limit.getSubmissionLimit());
                    ps.executeUpdate();
                    limit.setId(Database.getLastId(conn));
                } finally {
                    Database.dispose(ps);
                }
            }
            try {
                // update the problem
                ps = conn.prepareStatement(ProblemPersistenceImpl.UPDATE_PROBLEM);
                ps.setLong(1, problem.getContestId());
                ps.setString(2, problem.getTitle());
                ps.setString(3, problem.getCode());
                ps.setLong(4, limit.getId());
                ps.setString(5, problem.getAuthor());
                ps.setString(6, problem.getSource());
                ps.setString(7, problem.getContest());
                ps.setBoolean(8, problem.isChecker());
                ps.setLong(9, user);
View Full Code Here

Examples of com.abiquo.server.core.common.Limit

    // ************************** Mandatory constructors ***********************
    public DatacenterLimits(final Enterprise ent, final Datacenter dc)
    {
        setEnterprise(ent);
        setDatacenter(dc);
        setRamLimitsInMb(new Limit(0L, 0L));
        setHdLimitsInMb(new Limit(0L, 0L));
        setCpuCountLimits(new Limit(0L, 0L));
        setRepositoryLimits(new Limit(0L, 0L));
        setPublicIPLimits(new Limit(0L, 0L));
        setVlansLimits(new Limit(0L, 0L));
    }
View Full Code Here

Examples of com.abiquo.server.core.common.Limit

        final long storageHardLimitInMb, final long publicIPsoft, final long publicIPHard,
        final long vlanHard, final long vlanSoft)
    {
        setEnterprise(ent);
        setDatacenter(dc);
        setRamLimitsInMb(new Limit((long) ramSoftLimitInMb, (long) ramHardLimitInMb));
        setHdLimitsInMb(new Limit(hdSoftLimitInMb, hdHardLimitInMb));
        setCpuCountLimits(new Limit((long) cpuCountSoftLimit, (long) cpuCountHardLimit));
        setStorageLimits(new Limit(storageSoftLimitInMb, storageHardLimitInMb));
        setPublicIPLimits(new Limit(publicIPsoft, publicIPHard));
        setVlansLimits(new Limit(vlanHard, vlanSoft));
        setRepositoryLimits(new Limit(0L, 0L));
    }
View Full Code Here

Examples of com.abiquo.server.core.common.Limit

    }

    @LimitRange(type = "repository")
    public Limit getRepositoryLimits()
    {
        return new Limit(repositorySoft, repositoryHard);
    }
View Full Code Here

Examples of com.abiquo.server.core.common.Limit

    }

    @LimitRange(type = "repository")
    public Limit getRepositoryLimits()
    {
        return new Limit(repositorySoft, repositoryHard);
    }
View Full Code Here

Examples of com.abiquo.server.core.common.Limit

        final long hdSoftLimitInMb, final int ramHardLimitInMb, final int cpuCountHardLimit,
        final long hdHardLimitInMb)
    {
        setName(name);
        setIsReservationRestricted(Boolean.FALSE);
        setRamLimitsInMb(new Limit((long) ramSoftLimitInMb, (long) ramHardLimitInMb));
        setHdLimitsInMb(new Limit(hdSoftLimitInMb, hdHardLimitInMb));
        setCpuCountLimits(new Limit((long) cpuCountSoftLimit, (long) cpuCountHardLimit));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.