public static void rangeCheck(Object comp, boolean in, boolean out) throws Exception {
        ComponentAccess cp = new ComponentAccess(comp);
        Collection<Access> acc = new ArrayList<Access>();
        if (in) {
            acc.addAll(cp.inputs());
        }
        if (out) {
            acc.addAll(cp.outputs());
        }
        for (Access a : acc) {
            String name = a.getField().getName();
            Object val = a.getFieldValue();
            Range range = a.getField().getAnnotation(Range.class);
            if (range != null) {
                if (val instanceof Number) {
                    double v = ((Number) val).doubleValue();
                    if (!Annotations.inRange(range, v)) {
                        throw new ComponentException(name + " not in range " + v);
                    }
                } else if (val instanceof double[]) {
                    double[] v = (double[]) val;
                    for (int i = 0; i < v.length; i++) {
                        if (!Annotations.inRange(range, v[i])) {
                            throw new ComponentException(name + " not in range " + v[i]);
                        }
                    }
                }
            }
        }
    }