At 06:59 PM 8/12/2004 +0200, Antonio Pierro wrote:
Hi,
How can I insert a array of string through a ptolemy.data.expr.Parameter?
My essential code is:
import ptolemy.data.type.BaseType.StringType;
import ptolemy.data.expr.Parameter;
public Parameter _inputFileName;
_inputFileName=new Parameter(this,"_inputFileName");
_inputFileName.setTypeEquals(BaseType.??????);
_inputFileName.setExpression("");
thanks,
Antonio
Try:
_inputFileName=new Parameter(this,"_inputFileName");
_inputFileName.setTypeEquals(new ArrayType(BaseType.STRING));
_inputFileName.setExpression("{\"firstFileName\", \"secondFileName\"}");
However, notice that the name _inputFileName is not great:
1) If it's a string array, presumably it can specify multiple files.
The name implies one file.
2) Our coding convention uses leading underscores for private or
protected variables, but also defines a public variable for each
parameter.
Hence, I would suggest:
inputFileNames=new Parameter(this,"inputFileNames");
inputFileNames.setTypeEquals(new ArrayType(BaseType.STRING));
inputFileNames.setExpression("{\"firstFileName\", \"secondFileName\"}");
Edward
------------
Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
[EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal
----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: [EMAIL PROTECTED]