Package zz.jinterp.SimpleInterp

Examples of zz.jinterp.SimpleInterp.SimpleInstance


  /**
   * Creates a new uninitialized instance of this class.
   */
  public JInstance newInstance()
  {
    JInstance theInstance = new SimpleInstance(this);
   
    JClass theClass = this;
    while(theClass != null)
    {
      for (JField theField : theClass.getFields())
      {
        JObject theInitialValue = theField.getType().getInitialValue();
        theInstance.putFieldValue(theField, theInitialValue);
      }
     
      theClass = theClass.getSuperclass();
    }
   
View Full Code Here


  }
 
  public JInstance toJString(String aString)
  {
    JClass theClass = getClass("java/lang/String");
    SimpleInstance theInstance = new SimpleInstance(theClass);
   
    JField fOffset = theClass.getField("offset");
    JField fCount = theClass.getField("count");
    JField fValue = theClass.getField("value");
    JField fHash = theClass.getField("hash");
   
    theInstance.putFieldValue(fOffset, JInt._0);
    theInstance.putFieldValue(fCount, new JInt(aString.length()));
    theInstance.putFieldValue(fHash, new JInt(aString.hashCode()));
   
    JArray theValue = new SimpleArray(aString.length());
    for(int i=0;i<aString.length();i++) theValue.set(i, new JChar(aString.charAt(i)));
    theInstance.putFieldValue(fValue, theValue);
   
    return theInstance;
  }
View Full Code Here

TOP

Related Classes of zz.jinterp.SimpleInterp.SimpleInstance

Copyright © 2018 www.massapicom. 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.