001/*
002 * $Id$
003 */
004
005package edu.jas.kern;
006
007
008/**
009 * Scripting, defines script language for output in toScript() method.
010 * @author Heinz Kredel
011 */
012
013public class Scripting {
014
015
016    public static enum Lang {
017        Python, Ruby
018    };
019
020
021    private static Lang script = Lang.Python;
022
023
024    public static enum CAS {
025        JAS, Math, Sage, Singular
026    };
027
028
029    private static CAS cas = CAS.JAS;
030
031
032    private static int precision = -1; // == fraction output
033
034
035    protected Scripting() {
036    }
037
038
039    /**
040     * Get scripting language which is in effect.
041     * @return language which is to be used for toScript().
042     */
043    public static Lang getLang() {
044        return script;
045    }
046
047
048    /**
049     * Set scripting language.
050     * @param s language which is to be used for toScript()
051     * @return old language setting.
052     */
053    public static Lang setLang(Lang s) {
054        Lang o = script;
055        script = s;
056        return o;
057    }
058
059
060    /**
061     * Get CAS for Order which is in effect.
062     * @return CAS which is to be used for toScript().
063     */
064    public static CAS getCAS() {
065        return cas;
066    }
067
068
069    /**
070     * Set CAS for order.
071     * @param s CAS which is to be used for toScript()
072     * @return old CAS setting.
073     */
074    public static CAS setCAS(CAS s) {
075        CAS o = cas;
076        cas = s;
077        return o;
078    }
079
080
081    /**
082     * Get decimal approximation precision for scripting.
083     * @return number of decimals after '.'.
084     */
085    public static int getPrecision() {
086        return precision;
087    }
088
089
090    /**
091     * Set decimal approximation precision for scripting.
092     * @param p number of decimals after '.'
093     * @return old number of decimals after '.'.
094     */
095    public static int setPrecision(int p) {
096        int o = precision;
097        precision = p;
098        return o;
099    }
100
101}