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); } } }