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         * @param rank to set
026         */
027        void initialize(int rank);
028
029        /**
030         * Get axis datasets
031         * @return all axis datasets, any nulls represent default integer indexes, 
032         * each axis is the main specified axis. i.e the result of getAxis(n)[0]
033         */
034        public ILazyDataset[] getAxes();
035
036        /**
037         * Get all axis datasets for the given dimension
038         * @param axisDim dimension (n.b. this is zero-based)
039         * @return axis datasets, null represent default integer indexes, the order is in inverse importance.
040         */
041        public ILazyDataset[] getAxis(int axisDim);
042
043        /**
044         * Set axis datasets for given dimension. These datasets must be one dimensional or match rank
045         * with the associating dataset
046         * @param axisDim dimension (n.b. this is zero-based)
047         * @param axisData to set
048         */
049        public void setAxis(int axisDim, ILazyDataset... axisData);
050        
051        /**
052         * Add axis data to given dimension. This dataset must be one dimensional or match rank
053         * with the associating dataset
054         * @param axisDim dimension (n.b. this is zero-based)
055         * @param axisData dataset for axis
056         */
057        public void addAxis(int axisDim, ILazyDataset axisData);
058
059        /**
060         * Add axis data to given dimension. This dataset must be one dimensional or match rank
061         * with the associating dataset
062         * @param primaryAxisDim dimension (n.b. this is zero-based)
063         * @param axisData dataset for axis
064         * @param dimMapping indicates where each axis dimension maps to in the dataset dimensions  
065         */
066        public void addAxis(int primaryAxisDim, ILazyDataset axisData, int... dimMapping);
067
068        /**
069         * Refresh with given shape
070         * @param shape to set
071         * @return new shape
072         */
073        int[] refresh(int[] shape);
074}