Package org.netbeans.modules.exceptions.entity

Examples of org.netbeans.modules.exceptions.entity.Statistic


        this.prefix = prefix;
        this.persist = em;
    }

    public static Preferences root(Logfile log, Statistics<?> stat, EntityManager em) {
        Statistic statist = Statistic.getExists(stat.name);
        return new DbPreferences(null, "", statist, log, null, em);
    }
View Full Code Here


    Map<String, Integer> readMapFromByteArray(String key, Statistics statistics) throws BackingStoreException {
        Map<String, Integer> result = new HashMap<String, Integer>();
        byte[] array = getByteArray(key, null);
        if (array != null) {
            Statistic stat = Statistic.getExists(statistics.name);
            for (int index = 1; index <= Prefset.getMaxIndex(persist, stat); index++) {
                String mapKey = getValue(persist, statistics.name, index);
                int possition = index * BYTES_IN_INT;
                byte[] valueArray = new byte[BYTES_IN_INT];
                System.arraycopy(array, possition, valueArray, 0, BYTES_IN_INT);
View Full Code Here

    private static String getValue(EntityManager em, String statName, Integer index)throws BackingStoreException {
        Map<Integer, String> cache = getIndexCache(statName);
        String result = cache.get(index);
        if (result == null){   
            Query query = em.createNamedQuery("Prefset.findByStatisticAndIndex");
            Statistic stat = Statistic.getExists(statName);
            query.setParameter("statistic", stat.getId());
            query.setParameter("index", index);
            Prefset prefset = (Prefset) query.getSingleResult();
            result = prefset.getPrefname().getName();
        }
        return result;
View Full Code Here

    private static Integer getIndex(EntityManager em, String statName, String name) throws BackingStoreException {
        Map<Integer, Integer> cache = getCache(statName);
        Integer hashCode = name.hashCode();
        Integer index = cache.get(hashCode);
        if (index == null) {
            Statistic stat = Statistic.getExists(statName);
            index = Prefset.getByteArrayIndex(em, stat, name);
            if (cache.containsKey(hashCode)){
                throw new BackingStoreException("HashCode collision for " + name);
            }
            cache.put(hashCode, index);
View Full Code Here

TOP

Related Classes of org.netbeans.modules.exceptions.entity.Statistic

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.