001    /*
002     * Copyright (C) 2008-2010 by Holger Arndt
003     *
004     * This file is part of the Universal Java Matrix Package (UJMP).
005     * See the NOTICE file distributed with this work for additional
006     * information regarding copyright ownership and licensing.
007     *
008     * UJMP is free software; you can redistribute it and/or modify
009     * it under the terms of the GNU Lesser General Public License as
010     * published by the Free Software Foundation; either version 2
011     * of the License, or (at your option) any later version.
012     *
013     * UJMP is distributed in the hope that it will be useful,
014     * but WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016     * GNU Lesser General Public License for more details.
017     *
018     * You should have received a copy of the GNU Lesser General Public
019     * License along with UJMP; if not, write to the
020     * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
021     * Boston, MA  02110-1301  USA
022     */
023    
024    package org.ujmp.core.calculation;
025    
026    import java.io.Serializable;
027    
028    import org.ujmp.core.Matrix;
029    import org.ujmp.core.Matrix.StorageType;
030    import org.ujmp.core.annotation.Annotation;
031    import org.ujmp.core.enums.ValueType;
032    import org.ujmp.core.exceptions.MatrixException;
033    
034    /**
035     * Interface for matrix calculations.
036     * 
037     * @author arndt
038     */
039    public interface Calculation extends Serializable {
040    
041            public static final int ALL = Matrix.ALL;
042    
043            public static final int NONE = Matrix.NONE;
044    
045            public static final int ROW = Matrix.ROW;
046    
047            public static final int COLUMN = Matrix.COLUMN;
048    
049            public enum Ret {
050                    NEW, LINK, ORIG
051            };
052    
053            public static final Ret NEW = Ret.NEW;
054    
055            public static final Ret LINK = Ret.LINK;
056    
057            public static final Ret ORIG = Ret.ORIG;
058    
059            public Matrix calc(Ret returnType) throws MatrixException;
060    
061            public Matrix calcNew() throws MatrixException;
062    
063            public Matrix calcLink() throws MatrixException;
064    
065            public Matrix calcOrig() throws MatrixException;
066    
067            public boolean isSparse();
068    
069            public Annotation getAnnotation();
070    
071            public void setAnnotation(Annotation annotation);
072    
073            public long getValueCount();
074    
075            public Iterable<long[]> availableCoordinates();
076    
077            public Iterable<long[]> allCoordinates();
078    
079            public boolean contains(long... coordinates);
080    
081            public Matrix getSource();
082    
083            public Matrix[] getSources();
084    
085            public void setSources(Matrix... sources);
086    
087            public int getDimension();
088    
089            public void setDimension(int dimension);
090    
091            public long[] getSize();
092    
093            public ValueType getValueType();
094    
095            public Matrix[] calcMulti();
096    
097            public StorageType getStorageType();
098    
099    }