/*
 This file is part of the software framework JStatCom, 
 a library for building applications for data based analysis.

 Copyright (C) 2000-2005  Markus Kraetzig

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as
 published by the Free Software Foundation; either version 2.1 of the
 License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 */
package com.jstatcom.engine.matlab;

import com.jstatcom.engine.ConfigKeys;

/**
 * Contains all constants that can be changed for the the Matlab environment.
 * For every key the respective information is stored in an instance of
 * ConfigHolder.
 * 
 * @author Markus Kraetzig 
 */
public abstract class MatlabConfigKeys extends ConfigKeys {
    public static final MatlabConfigKeys DLL_NAME = new MatlabConfigKeys(
            "DLL_NAME") {

        public String isValid(String value) {
            if (value == null)
                return toString() + " cannot be null.";

            return null;
        }

        public String defaultVal() {
            return "mclmcrrt72";
        }
    };

    public static final MatlabConfigKeys RUNTIME_SUBDIR = new MatlabConfigKeys(
            "RUNTIME_SUBDIR") {

        public String isValid(String value) {
             return null;
        }

        public String defaultVal() {
            return "MATLAB Component Runtime\\v72\\runtime\\win32";
        }
    };

    /**
     * The size of the shared memory used for the communication.
     */
    public static final MatlabConfigKeys SHARED_MEM_SIZE = new MatlabConfigKeys(
            "SHARED_MEM_SIZE") {

        public String isValid(String value) {
            if (value == null)
                return toString() + " cannot be null.";

            int number = 0;
            int lowerBound = 1000;
            int upperBound = 1000000000;

            try {
                number = Integer.parseInt(value);
            } catch (NumberFormatException nEx) {
                return "SHARED_MEM_SIZE value \"" + value
                        + "\" is not a valid integer number.";
            }
            if (number < lowerBound || number > upperBound)
                return "SHARED_MEM_SIZE value \"" + value
                        + "\" is not in the valid range of [" + lowerBound
                        + ";" + upperBound
                        + "].\nA reasonable default value is " + defaultVal()
                        + ".";
            return null;
        }

        public String defaultVal() {
            return "10000000";
        }
    };

    /**
     * Matlab compiler version.
     */
    public static final MatlabConfigKeys MATLAB_COMPILER_VERSION = new MatlabConfigKeys(
            "MATLAB_COMPILER_VERSION") {

        public String isValid(String value) {
            return null;
        }

        public String defaultVal() {
            return "4.0";
        }
    };

    /**
     * Constructor.
     * 
     * @param name
     *            the name of the new constant
     */
    MatlabConfigKeys(String name) {
        super(name);
    }
}
 

Ads help maintain this website.