001/* ASTPtMatrixConstructNode represents matrix construction in the parse tree. 002 003 Copyright (c) 1998-2014 The Regents of the University of California and 004 Research in Motion Limited. 005 All rights reserved. 006 Permission is hereby granted, without written agreement and without 007 license or royalty fees, to use, copy, modify, and distribute this 008 software and its documentation for any purpose, provided that the above 009 copyright notice and the following two paragraphs appear in all copies 010 of this software. 011 012 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA OR RESEARCH IN MOTION 013 LIMITED BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, 014 INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS 015 SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA 016 OR RESEARCH IN MOTION LIMITED HAVE BEEN ADVISED OF THE POSSIBILITY OF 017 SUCH DAMAGE. 018 019 THE UNIVERSITY OF CALIFORNIA AND RESEARCH IN MOTION LIMITED 020 SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 021 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 022 PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" 023 BASIS, AND THE UNIVERSITY OF CALIFORNIA AND RESEARCH IN MOTION 024 LIMITED HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 025 ENHANCEMENTS, OR MODIFICATIONS. 026 027 028 Created : May 1998 029 030 */ 031package ptolemy.data.expr; 032 033import ptolemy.kernel.util.IllegalActionException; 034 035////////////////////////////////////////////////////////////////////////// 036//// ASTPtMatrixConstructNode 037 038/** 039 The parse tree created from the expression string consists of a 040 hierarchy of node objects. This class represents matrix construction using 041 Matlab like expressions. 042 043 @author Xiaojun Liu 044 @version $Id$ 045 @since Ptolemy II 0.3 046 @Pt.ProposedRating Yellow (nsmyth) 047 @Pt.AcceptedRating Red (cxh) 048 @see ptolemy.data.expr.ASTPtRootNode 049 @see ptolemy.data.expr.PtParser 050 @see ptolemy.data.Token 051 */ 052public class ASTPtMatrixConstructNode extends ASTPtRootNode { 053 public ASTPtMatrixConstructNode(int id) { 054 super(id); 055 } 056 057 public ASTPtMatrixConstructNode(PtParser p, int id) { 058 super(p, id); 059 } 060 061 public int getColumnCount() { 062 return _nColumns; 063 } 064 065 public int getForm() { 066 return _form; 067 } 068 069 public int getRowCount() { 070 return _nRows; 071 } 072 073 /** Traverse this node with the given visitor. 074 */ 075 @Override 076 public void visit(ParseTreeVisitor visitor) throws IllegalActionException { 077 visitor.visitMatrixConstructNode(this); 078 } 079 080 /** The number of rows of the matrix construction. 081 */ 082 protected int _nRows; 083 084 /** The number of columns of the matrix construction. 085 */ 086 protected int _nColumns; 087 088 /** The form of the matrix construction. 089 * _form is 1 when the matrix construction gives all elements. 090 * _form is 2 when using regularly spaced vector construction. 091 */ 092 protected int _form; 093}