<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Call _container().getName()<br>
      <br>
      The name of the instance of the actor is StringConst.  It an
      instance of the Java class ptolemy.actor.lib.StringConst.<br>
      <br>
      If you pasted another StringConst in, its name would be
      StringConst1 (I think) and it would be an instance of the Java
      class ptolemy.actor.lib.StringConst.<br>
      <br>
      getName() returns the name of the actor instance which is unique.<br>
      <br>
      In your screen shot, you have a Parameter that is an instance of
      the ptolemy.data.expr.TemporaryVariable that is contained in a
      StringConst actor.<br>
      <br>
      <br>
      BTW - You should take a look at the Software Architecture chapter
      at
<a class="moz-txt-link-freetext" href="http://ptolemy.eecs.berkeley.edu/books/Systems/chapters/SoftwareArchitecture.pdf">http://ptolemy.eecs.berkeley.edu/books/Systems/chapters/SoftwareArchitecture.pdf</a><br>
      <br>
      of the book<br>
      <br>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      Claudius Ptolemaeus, Editor, <i>System Design, Modeling, and
        Simulation Using Ptolemy II</i>, Ptolemy.org, 2014.
      <br>
      <br>
      at <a class="moz-txt-link-freetext" href="http://ptolemy.eecs.berkeley.edu/books/Systems/index.htm">http://ptolemy.eecs.berkeley.edu/books/Systems/index.htm</a><br>
      <br>
      _Christopher<br>
      <br>
      On 11/17/14 11:06 AM, DONGHOON KIM wrote:<br>
    </div>
    <blockquote
cite="mid:CAHwMc7VFm7qHpDjh_MB3HYmTr=hNNwgbJyWb8JcouTkW-GiQZg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Christopher,  
        <div><br>
        </div>
        <div>Thank you for your answers to my questions! </div>
        <div><br>
        </div>
        <div>What about the name of the container (i.e., _container)? </div>
        <div>When I debugged, I have found that the value of "
          _container" (red box in the attached pic) is "StringConst". </div>
        <div>If this value is also unique, I want to extract this value
          instead of the full qualified classname. </div>
        <div>lastIndexOf() may need extra work to extract the value
          "StringConst".</div>
        <div>Do you know any other function to extract the value
          "StringConst"? maybe... getUnderBarContainer. </div>
        <div>but I can not find that function in source code. </div>
        <div><br>
        </div>
        <div>Please, let me know </div>
        <div><br>
        </div>
        <div>Thank you </div>
        <div><br>
        </div>
        <div>-Donghoon</div>
        <div><br>
        </div>
        <div> </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Nov 17, 2014 at 1:35 PM,
          Christopher Brooks <span dir="ltr"><<a
              moz-do-not-send="true" href="mailto:cxh@eecs.berkeley.edu"
              target="_blank">cxh@eecs.berkeley.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Hi Donghoon,<br>
                <br>
                In Java, the fully qualified classname must be unique. 
                There is some magic that can be done with different
                class loaders and such, but in general, and in Kepler
                and Ptolemy, the fully qualified classname will be
                unique.  The fully qualified classname includes the
                package,  So, ptolemy.actor.lib.StringConstant is one
                actor.   There can be another actor,
                ptolemy.actor.lib.mypackage.StringConstant.  Both actors
                could be used in a model.<br>
                <br>
                Note that Kepler has actor oriented classes (see <a
                  moz-do-not-send="true"
href="http://ptolemy.eecs.berkeley.edu/publications/papers/07/classesandInheritance/index.htm"
                  target="_blank">http://ptolemy.eecs.berkeley.edu/publications/papers/07/classesandInheritance/index.htm</a>). 

                The quick summary of actor oriented classes is that they
                are chunks of functionality implemented as Ptolemy
                models that can be reused by instantiation or
                subclassing.  The Sinewave actor is an actor-oriented
                class.  When you are calling
                parameter.getContainer().getClassName(), you are getting
                the className which may or may not be the same as the
                Java class name.<br>
                <br>
                Probably the method that is being called is in
                ptolemy/kernel/util/NamedObj.java:<br>
                <blockquote type="cite">   /** Return the MoML class
                  name.  This is either
                  the                                                            
                   <br>
                       *  class of which this object is an instance, or
                  if
                  this                                                      
                   <br>
                       *  object is itself a class, then the class that
                  it
                  extends.                                                  
                   <br>
                       *  By default, it will be the Java class name of
                  this
                  object.                                                 
                   <br>
                       *  This method never returns
                  null.                                                                            

                   <br>
                       *  @return The MoML class
                  name.                                                                               

                   <br>
                       *  @see
                  MoMLExportable                                                                                        

                   <br>
                       *  @see
                  #setClassName(String)                                                                                 

                   <br>
                       */<br>
                      @Override<br>
                      public String getClassName() {<br>
                      if (_className == null) {<br>
                              _className = getClass().getName();<br>
                          }<br>
                  <br>
                          return _className;<br>
                      }<br>
                </blockquote>
                <br>
                _className is set when instantiating clones for
                actor-oriented classes.<br>
                <br>
                <br>
                To get the last part of the fully qualified classname,
                see the lastIndexOf() method in the java.lang.String
                class:
                <a moz-do-not-send="true"
href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#lastIndexOf-int"
                  target="_blank">https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#lastIndexOf-int</a>-<br>
                <br>
                However, I think you just want to call
                NamedObj.getName():   parameter.getContainer().getName()
                should do the trick.<br>
                <br>
                _Christopher
                <div>
                  <div class="h5"><br>
                    <br>
                    On 11/17/14 9:47 AM, DONGHOON KIM wrote:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div dir="ltr">Dear Kepler folks, 
                      <div><br>
                      </div>
                      <div>In ActorReference.pdf file, there are
                        explanations of each actors.  I have questions
                        for this reference.</div>
                      <div>
                        <ul>
                          <li>I can see the class name next to an actor.
                            For example, String Constant
                            (ptolemy.actor.lib.StringConst). The class
                            name must be unique
                            (i.e., ptolemy.actor.lib.StringConst). If
                            so, is the last classname unique? In other
                            words, "StringConst" is also unique?</li>
                          <li>I can see the value of "StringConst" in
                            _container in parameter class. How can I
                            just extract only last name "StringConst"?
                            Actually, I have tried several ways in
                            SQLRecording.java like below:</li>
                          <ul>
                            <li> System.out.println("3: " +
                              parameter.getContainer().toplevel().toString());</li>
                            <li> System.out.println("4: " +
                              parameter.getContainer().getClassName());</li>
                            <li> System.out.println("5: " +
                              parameter.getContainer());</li>
                          </ul>
                        </ul>
                      </div>
                      <blockquote style="margin:0 0 0
                        40px;border:none;padding:0px">
                        <div>The output is :</div>
                      </blockquote>
                      <div>
                        <ul>
                          <ul>
                            <li>3: ptolemy.actor.TypedCompositeActor
                              {.Unnamed1}</li>
                            <li>4: ptolemy.actor.lib.StringConst</li>
                            <li>5: ptolemy.actor.lib.StringConst
                              {.Unnamed1.DonghoonConstant}</li>
                          </ul>
                        </ul>
                        <div>Please, let me know </div>
                        <div><br>
                        </div>
                        <div>Thank you </div>
                        <div><br>
                        </div>
                        <div>-Donghoon</div>
                      </div>
                      <div>
                        <div><br clear="all">
                          <div><br>
                          </div>
                          -- <br>
                          <div>Donghoon Kim<br>
                            Dept of Computer Science<br>
                            North Carolina State University<br>
                            <br>
                            <br>
                          </div>
                        </div>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </div>
                <pre>_______________________________________________
Kepler-dev mailing list
<a moz-do-not-send="true" href="mailto:Kepler-dev@kepler-project.org" target="_blank">Kepler-dev@kepler-project.org</a>
<a moz-do-not-send="true" href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev" target="_blank">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre>
                <span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
              <span class="HOEnZb"><font color="#888888"> <br>
                  <br>
                  <pre cols="72">-- 
Christopher Brooks, PMP                       University of California
Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm               Berkeley, CA 94720-1774
<a moz-do-not-send="true" href="mailto:cxh@eecs.berkeley.edu" target="_blank">cxh@eecs.berkeley.edu</a>, <a moz-do-not-send="true" href="tel:707.332.0670" value="+17073320670" target="_blank">707.332.0670</a>           (Office: 545Q Cory)
</pre>
                </font></span></div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">Donghoon Kim<br>
          Dept of Computer Science<br>
          North Carolina State University<br>
          <br>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Christopher Brooks, PMP                       University of California
Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm               Berkeley, CA 94720-1774
<a class="moz-txt-link-abbreviated" href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>, 707.332.0670           (Office: 545Q Cory)
</pre>
  </body>
</html>