Package ket.math.purpose.function

Source Code of ket.math.purpose.function.FunctionTranspose

/*
* Copyright (C) 2011  Alasdair C. Hamilton
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>
*/

package ket.math.purpose.function;

import java.awt.*;
import java.util.*;

import ket.display.*;
import ket.display.box.Box;
import ket.display.box.BoxTools;
import ket.display.box.BoxWord;
import ket.math.*;

public class FunctionTranspose extends FunctionForm {

  @Override
  public String toLatex(Vector<Argument> args) {
    if (args.size()==1) {
      return args.get(0).toLatex() + "^T";
    } else {
      return super.toLatex(args);
    }
  }

  @Override
  public Box toBox(Argument argument, Vector<Box> boxArgs, long settings, ColourScheme colourScheme) {
    switch (boxArgs.size()) {
      case 0:
      case 1:
        boxArgs.add(new BoxWord(argument, "T", settings));
        boxArgs.get(1).setProperty(Box.PLAIN_FONT|Box.TOP_ALIGN|Box.SMALL_FONT);
        return BoxTools.centredHorizontalBoxList(argument, settings, boxArgs);
      default:
        return super.toBox(argument, boxArgs, settings, colourScheme);
    }
  }
}
TOP

Related Classes of ket.math.purpose.function.FunctionTranspose

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.