Examples of JInt


Examples of zz.jinterp.JPrimitive.JInt

  {
    JObject[] args = {};
    JObject theResult = interp.invoke(null, "zz/jinterp/SimpleClass", "s", "()I", null, args);
    if (theResult instanceof JInt)
    {
      JInt theInt = (JInt) theResult;
      Assert.assertEquals(theInt.v, SimpleClass.s());
    }
    else Assert.fail();
  }
View Full Code Here

Examples of zz.jinterp.JPrimitive.JInt

 
  @org.junit.Test
  public void testException()
  {
    JObject[] args = {};
    JInt theResult = (JInt) interp.invoke(null, "zz/jinterp/SimpleClass", "testException1", "()I", null, args);
    Assert.assertEquals(theResult.v, 4);
  }
View Full Code Here

Examples of zz.jinterp.JPrimitive.JInt

 
  public String __toString() {return null;}
  public JObject _toString(JFrame aParentFrame, JInstance aTarget, JObject[] aArgs)
  {
    JClass theClass = aTarget.getType();
    JInt theCode = (JInt) theClass.getVirtualBehavior("hashCode", "()I").invoke(aParentFrame, aTarget);
    String theString = theClass.getName().replace('/', '.') + "@" + Integer.toHexString(theCode.v);
    return theClass.getInterpreter().toJString(theString);
  }
View Full Code Here

Examples of zz.jinterp.JPrimitive.JInt

 
  public int __hashCode() {return 0;}
  public JObject _hashCode(JFrame aParentFrame, JInstance aTarget, JObject[] aArgs)
  {
    int theCode = System.identityHashCode(aTarget);
    return new JInt(theCode);
  }
View Full Code Here

Examples of zz.jinterp.JPrimitive.JInt

 
  public JObject toJObject(Object aObject)
  {
    if (aObject instanceof Integer)
    {
      return new JInt((Integer) aObject);
    }
    else if (aObject instanceof Long)
    {
      return new JLong((Long) aObject);
    }
View Full Code Here

Examples of zz.jinterp.JPrimitive.JInt

    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);
   
View Full Code Here

Examples of zz.jinterp.JPrimitive.JInt

   
    JField fOffset = theClass.getField("offset");
    JField fCount = theClass.getField("count");
    JField fValue = theClass.getField("value");

    JInt theOffset = (JInt) aInstance.getFieldValue(fOffset);
    JInt theCount = (JInt) aInstance.getFieldValue(fCount);
    JArray theValue = (JArray) aInstance.getFieldValue(fValue);
   
    char[] theChars = new char[theCount.v];
    for(int i=0;i<theCount.v;i++) theChars[i] = ((JChar) theValue.get(i+theOffset.v)).v;
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.