public void lineStart(boolean flag) throws IOException {
   if (flag) {
     break MISSING_BLOCK_LABEL_64;
   }
   if (tie != null) {
     tie.freshLine();
   }
   if (prompter == null) {
     break MISSING_BLOCK_LABEL_64;
   }
   Object obj;
   try {
     obj = prompter.apply1(this);
   } catch (Throwable throwable) {
     throw new IOException(
         (new StringBuilder())
             .append("Error when evaluating prompt:")
             .append(throwable)
             .toString());
   }
   if (obj == null) {
     break MISSING_BLOCK_LABEL_64;
   }
   obj = obj.toString();
   if (obj == null) {
     break MISSING_BLOCK_LABEL_64;
   }
   if (((String) (obj)).length() > 0) {
     emitPrompt(((String) (obj)));
     promptEmitted = true;
   }
 }
Ejemplo n.º 2
0
 public E get(int[] indexes) {
   try {
     return (E) proc.apply1(new S32Vector(indexes));
   } catch (Throwable ex) {
     throw new RuntimeException("caught " + ex + " evaluating array procedure", ex);
   }
 }
Ejemplo n.º 3
0
 public int effectiveIndex(int[] indexes) {
   Object obj;
   try {
     obj = proc.apply1(indexes);
   } catch (Throwable ex) {
     throw new RuntimeException("index transformer throw " + ex, ex);
   }
   if (obj instanceof int[]) return base.effectiveIndex((int[]) obj);
   IntSequence ind = Sequences.asIntSequenceOrNull(obj);
   if (ind == null) throw new ClassCastException("not an integer sequence");
   if (ind instanceof S32Vector) return base.effectiveIndex(((S32Vector) ind).getBuffer());
   else {
     int rank = ind.size();
     switch (rank) {
       case 0:
         return base.effectiveIndex();
       case 1:
         return base.effectiveIndex(ind.getInt(0));
       case 2:
         return base.effectiveIndex(ind.getInt(0), ind.getInt(1));
       default:
         int[] rest = rank == 3 ? AbstractSequence.noInts : new int[rank - 3];
         for (int i = 3; i < rank; i++) rest[i - 3] = ind.getInt(i);
         return base.effectiveIndex(ind.getInt(0), ind.getInt(1), ind.getInt(2), rest);
     }
   }
 }
Ejemplo n.º 4
0
 protected T coerce(T newValue) {
   try {
     return (T) converter.apply1(newValue);
   } catch (Throwable ex) {
     throw WrappedException.rethrow(ex);
   }
 }