Beispiel #1
0
 public IokeObject newMacro(String doc, IokeObject tp, IokeData impl) throws ControlFlow {
   IokeObject obj = tp.allocateCopy(null, null);
   obj.setDocumentation(doc, null, null);
   obj.mimicsWithoutCheck(tp);
   obj.setData(impl);
   return obj;
 }
Beispiel #2
0
 public IokeObject newRegexp(String pattern, String flags, IokeObject context, IokeObject message)
     throws ControlFlow {
   IokeObject obj = this.regexp.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.regexp);
   obj.setData(Regexp.create(pattern, flags, context, message));
   return obj;
 }
Beispiel #3
0
 public IokeObject newCallFrom(
     IokeObject ctx, IokeObject message, IokeObject surroundingContext, IokeObject on) {
   IokeObject obj = this.call.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.call);
   obj.setData(new Call(ctx, message, surroundingContext, on));
   return obj;
 }
Beispiel #4
0
 public IokeObject newNumber(RatNum number) {
   if (number instanceof IntNum) {
     return newNumber((IntNum) number);
   } else {
     IokeObject obj = this.ratio.allocateCopy(null, null);
     obj.mimicsWithoutCheck(this.ratio);
     obj.setData(Number.ratio((IntFraction) number));
     return obj;
   }
 }
Beispiel #5
0
 public IokeObject newFile(IokeObject context, File eff) throws ControlFlow {
   IokeObject fileMimic =
       IokeObject.as(
           ((Message) IokeObject.data(FileMessage)).sendTo(FileMessage, context, this.fileSystem),
           context);
   IokeObject obj = fileMimic.allocateCopy(null, null);
   obj.mimicsWithoutCheck(fileMimic);
   obj.setData(new FileSystem.IokeFile(eff));
   return obj;
 }
Beispiel #6
0
 public IokeObject createIntegratedJavaWrapper(Class clz) {
   IokeObject obj = this.javaWrapper.allocateCopy(null, null);
   obj.mimicsWithoutCheck(registry.wrap(Class.class));
   obj.mimicsWithoutCheck(registry.wrap(clz.getSuperclass()));
   for (Class<?> i : clz.getInterfaces()) {
     obj.mimicsWithoutCheck(registry.wrap(i));
   }
   obj.setData(JavaIntegrationWrapper.wrapWithMethods(clz, obj, this));
   return obj;
 }
Beispiel #7
0
 public IokeObject newNumber(IntNum number) {
   IokeObject obj = null;
   obj = numCache.get(number);
   if (obj == null) {
     obj = this.integer.allocateCopy(null, null);
     obj.mimicsWithoutCheck(this.integer);
     obj.setData(Number.integer(number));
     numCache.put(number, obj);
   }
   return obj;
 }
Beispiel #8
0
  public IokeObject createJavaWrapper(Object object) {
    if (object instanceof Class) {
      if (object == Object.class) {
        IokeObject obj = this.javaWrapper.allocateCopy(null, null);
        obj.mimicsWithoutCheck(this.javaWrapper);
        obj.setData(JavaWrapper.wrapWithMethods((Class) object, obj, this));
        return obj;
      } else if (object == Class.class) {
        IokeObject obj = this.javaWrapper.allocateCopy(null, null);
        Class<?> clz = (Class) object;
        IokeObject objWrap = registry.wrap(clz.getSuperclass());
        obj.mimicsWithoutCheck(objWrap);
        obj.setData(JavaWrapper.wrapWithMethods(clz, obj, this));

        objWrap.mimicsWithoutCheck(0, obj); // circularity - warning! =)

        return obj;
      } else {
        IokeObject obj = this.javaWrapper.allocateCopy(null, null);
        Class<?> clz = (Class) object;
        if (((Class) object).isArray()) {
          obj.mimicsWithoutCheck(javaArray);
        }
        obj.mimicsWithoutCheck(registry.wrap(Class.class));
        obj.mimicsWithoutCheck(registry.wrap(clz.getSuperclass()));
        for (Class<?> i : clz.getInterfaces()) {
          obj.mimicsWithoutCheck(registry.wrap(i));
        }
        obj.setData(JavaWrapper.wrapWithMethods(clz, obj, this));
        return obj;
      }
    } else {
      IokeObject obj = this.javaWrapper.allocateCopy(null, null);
      obj.mimicsWithoutCheck(registry.wrap(object.getClass()));
      obj.setData(new JavaWrapper(object));
      return obj;
    }
  }
Beispiel #9
0
 public IokeObject newRange(IokeObject from, IokeObject to, boolean inclusive, boolean inverted) {
   IokeObject obj = this.range.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.range);
   obj.setData(new Range(from, to, inclusive, inverted));
   return obj;
 }
Beispiel #10
0
 public IokeObject newDateTime(org.joda.time.DateTime dt) {
   IokeObject obj = this.dateTime.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.dateTime);
   obj.setData(new DateTime(dt));
   return obj;
 }
Beispiel #11
0
 public IokeObject newList(List<Object> list, IokeObject orig) {
   IokeObject obj = orig.allocateCopy(null, null);
   obj.mimicsWithoutCheck(orig);
   obj.setData(new IokeList(list));
   return obj;
 }
Beispiel #12
0
 public IokeObject newList(List<Object> list) {
   IokeObject obj = this.list.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.list);
   obj.setData(new IokeList(list));
   return obj;
 }
Beispiel #13
0
 public IokeObject newSet(Collection<Object> objs) {
   IokeObject obj = this.set.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.set);
   obj.setData(new IokeSet(new HashSet<Object>(objs)));
   return obj;
 }
Beispiel #14
0
 public IokeObject newDict(Map<Object, Object> map) {
   IokeObject obj = dict.allocateCopy(null, null);
   obj.mimicsWithoutCheck(dict);
   obj.setData(new Dict(map));
   return obj;
 }
Beispiel #15
0
 public IokeObject createMessage(Message m) {
   IokeObject obj = this.message.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.message);
   obj.setData(m);
   return obj;
 }
Beispiel #16
0
 public IokeObject newText(String text) {
   IokeObject obj = this.text.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.text);
   obj.setData(new Text(text));
   return obj;
 }
Beispiel #17
0
 public IokeObject newPair(Object first, Object second) {
   IokeObject obj = this.pair.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.pair);
   obj.setData(new Pair(first, second));
   return obj;
 }
Beispiel #18
0
 public IokeObject newDecimal(BigDecimal number) throws ControlFlow {
   IokeObject obj = this.decimal.allocateCopy(null, null);
   obj.mimicsWithoutCheck(this.decimal);
   obj.setData(Decimal.decimal(number));
   return obj;
 }