public void addDimension(Dimension dim) {
        dimensions.put(dim.getName(), dim);

        Object[] o = dimensions.values().toArray();
        dimensionArray = new Dimension[dimensions.size()];
        for (int i = 0; i < dimensions.size(); i++) {
            dimensionArray[i] = (Dimension)(o[i]);
        }
    }