Christopher,

Thanks for quick reply !

So, 

What is the difference of doing between setContainer &
setName and calling constructor with container and
name arguments?

Is it setting internal Actor information missing in
first way? For example, in the following PoissonClock
actor code, I will miss the internal state setting,
(meanTime,values, output class members).

If I would put this constructor into another method
with only name parameter, say PoissonClockCreate,
without "super (container,name)" line
then call it like this, still can't I achieve same
effect?:

p = new PoissonClock()
p.setName(name)
p.setContainer(container)
p.PoissonClockCreater(name);

public void PoissonClockCreate(String name)
            throws NameDuplicationException,
IllegalActionException {
//Skip this
//super (container,name);
//The rest will be same as original constructor
....

}



public PoissonClock(CompositeEntity container, String
name)
            throws NameDuplicationException,
IllegalActionException {
        super(container, name);

        meanTime = new Parameter(this, "meanTime");
        meanTime.setExpression("1.0");
        meanTime.setTypeEquals(BaseType.DOUBLE);

        // Set the values parameter
        values = new Parameter(this, "values");
        values.setExpression("{1, 0}");
        values.setTypeEquals(new
ArrayType(BaseType.UNKNOWN));

        // set type constraint
        ArrayType valuesArrayType = (ArrayType)
values.getType();
        InequalityTerm elementTerm =
valuesArrayType.getElementTypeTerm();
        output.setTypeAtLeast(elementTerm);

        // Call this so that we don't have to copy its
code here...
        attributeChanged(values);

        fireAtStart = new Parameter(this,
"fireAtStart");
        fireAtStart.setExpression("true");
        fireAtStart.setTypeEquals(BaseType.BOOLEAN);
    }


--- Christopher Brooks <[EMAIL PROTECTED]> wrote:

> Constructing the CompositeActor/Actor/Director and
> then
> setting the name and container are not semantically
> the same if
> the constructor uses the name and container.   One
> can get
> around this by being crafty, but that's not what
> what we did.
> 
> I think there is pretty good argument to be made for
> doing very little
> in the constructor.  We've had problems several
> times because we
> were doing too much in the constructor
> 
> BTW There is some Ptolemy Corba code in the devel
> tree at
> ptII/ptolemy/actor/corba/
> This code has never been released in a formal
> Ptolemy release.
> 
> See http://chess.eecs.berkeley.edu/ptexternal
> for how to access the devel tree via CVS
> 
> _Christopher
> --------
> 
>     Hi:
>     
>     I am working on a Distributed Ptolemy through
>     CORBA/EJB/Web Services,
>     
>     I am learning the Ptolemy code. I like its
> software
>     architecture, that is good to me.
>     
>     I have a question. When we run a model with
>     PtExecuteApplication provided with XML source of
>     model,  Ptolemy internally calls the constructor
> like
>     this:
>     
>     public CompositeActor/Actor/Director
> (CompositeEntity
>     container, String name)
>     
>     Here I have a question. If I would instantiate
> the
>     constructor with empty argument like this:
>     
>      public CompositeActor() 
>     
>     and call setContainer and setName on the result
>     object:
>     
>     I mean:
>     
>     Current way:
>     
>     p = new Actor/CompositeActor/Director
> (container,
>     name)
>     
>     Instead of this, this  will be equal to above
>     semantically:
>     
>     p = new Actor/CompositeActor/Director ();
>     p.setContainer (container)
>     p.setName(name)
>     
>     Thanks 
>     
>     Best Regards
>     
>     Erol Akarsu
>         
>         public CompositeActor(Workspace workspace) 
>         
>     
>         
>         public CompositeActor (CompositeEntity
> container,
>     String name)
>                 
>         
>     
>     
>               
>     __________________________________ 
>     Yahoo! Mail - PC Magazine Editors' Choice 2005 
>     http://mail.yahoo.com
>     
>    
>
---------------------------------------------------------------------------
>    -
>     Posted to the ptolemy-hackers mailing list. 
> Please send administrative
>     mail for this list to:
> [EMAIL PROTECTED]
> --------
> 


                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to