    001/*-
    002 *******************************************************************************
    003 * Copyright (c) 2011, 2016 Diamond Light Source Ltd.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the Eclipse Public License v1.0
    006 * which accompanies this distribution, and is available at
    007 * http://www.eclipse.org/legal/epl-v10.html
    008 *
    009 * Contributors:
    010 *    Peter Chang - initial API and implementation and/or initial documentation
    011 *******************************************************************************/
    012
    013package org.eclipse.january.metadata;
    014
    015import org.eclipse.january.dataset.ILazyDataset;
    016
    017/**
    018 * This metadata describes any axis information associated with a dataset.
    019 * Dimension numbers are zero-based, i.e. the first dimension is numbered
    020 * zero.
    021 */
    022public interface AxesMetadata extends MetadataType {
    023
    024        /**
    025         *
    026         * @param rank
    027         */
    028        void initialize(int rank);
    029
    030        /**
    031         * Get axis datasets
    032         * @return all axis datasets, any nulls represent default integer indexes,
    033         * each axis is the main specified axis. i.e the result of getAxis(n)[0]
    034         */
    035        public ILazyDataset[] getAxes();
    036
    037        /**
    038         * Get all axis datasets for the given dimension
    039         * @param axisDim dimension (n.b. this is zero-based)
    040         * @return axis datasets, null represent default integer indexes, the order is in inverse importance.
    041         */
    042        public ILazyDataset[] getAxis(int axisDim);
    043
    044        /**
    045         * Set axis datasets for given dimension. These datasets must be one dimensional or match rank
    046         * with the associating dataset
    047         * @param axisDim
    048         * @param axisData
    049         */
    050        public void setAxis(int axisDim, ILazyDataset... axisData);
    051
    052        /**
    053         * Add axis data to given dimension. This dataset must be one dimensional or match rank
    054         * with the associating dataset
    055         * @param axisDim dimension (n.b. this is zero-based)
    056         * @param axisData dataset for axis
    057         */
    058        public void addAxis(int axisDim, ILazyDataset axisData);
    059
    060        /**
    061         * Add axis data to given dimension. This dataset must be one dimensional or match rank
    062         * with the associating dataset
    063         * @param primaryAxisDim dimension (n.b. this is zero-based)
    064         * @param axisData dataset for axis
    065         * @param dimMapping indicates where each axis dimension maps to in the dataset dimensions
    066         */
    067        public void addAxis(int primaryAxisDim, ILazyDataset axisData, int... dimMapping);
    068
    069        /**
    070         * Refresh with given shape
    071         * @param shape
    072         * @return new shape
    073         */
    074        int[] refresh(int[] shape);
    075}