Package com.guokr.simbase.errors

Examples of com.guokr.simbase.errors.SimEngineException


                    intermedia = (Map<String, Object>) intermedia.get(key);
                } catch (ClassCastException e) {
                    intermedia = null;
                }
                if (intermedia == null) {
                    throw new SimEngineException("configruation[" + key + "] is missing");
                }
            } else {
                try {
                    result = (String) intermedia.get(key);
                } catch (ClassCastException e) {
View Full Code Here


        this.startCron();
    }

    private void validatePath(String filePath) throws SimEngineException {
        if (!new File(filePath).exists()) {
            throw new SimEngineException(String.format("Dmp file '%s' not exists", filePath));
        }
    }
View Full Code Here

        }
    }

    private void validateKeyFormat(String key) throws SimEngineException {
        if (key.indexOf('_') > -1) {
            throw new SimEngineException(String.format("Invalid key format '%s'", key));
        }
    }
View Full Code Here

        }
    }

    private void validateExistence(String toCheck) throws SimEngineException {
        if (!basisOf.containsKey(toCheck)) {
            throw new SimEngineException(String.format("Unknown data entry '%s'", toCheck));
        }
    }
View Full Code Here

        }
    }

    private void validateNotExistence(String toCheck) throws SimEngineException {
        if (basisOf.containsKey(toCheck)) {
            throw new SimEngineException(String.format("Data entry '%s' already exists", toCheck));
        }
    }
View Full Code Here

        }
    }

    private void validateKind(String op, String toCheck, Kind kindShouldBe) throws SimEngineException {
        if (!kindOf.containsKey(toCheck) || !kindShouldBe.equals(kindOf.get(toCheck))) {
            throw new SimEngineException(String.format("Operation '%s' against a non-%s type '%s'", op, kindShouldBe,
                    toCheck));
        }
    }
View Full Code Here

        }
    }

    private void validateId(int toCheck) throws SimEngineException {
        if (toCheck < 1) {
            throw new SimEngineException(String.format("Inviad id '%d', should be positive integer", toCheck));
        }
    }
View Full Code Here

    }

    private void validatePairs(int maxIndex, int[] toCheck) throws SimEngineException {
        int len = toCheck.length;
        if (len % 2 != 0) {
            throw new SimEngineException("Sparse vector should be paired");
        }
        for (int offset = 0; offset < len; offset += 2) {
            if (toCheck[offset] < 0 || toCheck[offset] > maxIndex) {
                throw new SimEngineException(String.format("Sparse matrix index '%d' out of bound", toCheck[offset]));
            }
            if (toCheck[offset + 1] < 0) {
                throw new SimEngineException(String.format("Sparse matrix value '%d' should be non-negative",
                        toCheck[offset + 1]));
            }
        }
    }
View Full Code Here

        }
    }

    private void validateSameBasis(String vkeySource, String vkeyTarget) {
        if (!basisOf.get(vkeySource).equals(basisOf.get(vkeyTarget))) {
            throw new SimEngineException(String.format(
                    "Recommedation[%s_%s] must be between two vector set with same basis", vkeySource, vkeyTarget));
        }
    }
View Full Code Here

        List<String> schema = new ArrayList<String>(Arrays.asList(comps));
        Map<String, Integer> compIndex = new HashMap<String, Integer>();
        int index = 0;
        for (String comp : schema) {
            if (compIndex.containsKey(comp)) {
                throw new SimEngineException(String.format("Dupicate base schema '%s'", comp));
            } else {
                compIndex.put(comp, index++);
            }
        }
        this.key = key;
View Full Code Here

TOP

Related Classes of com.guokr.simbase.errors.SimEngineException

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.