Get the indices of participating repeats in cyclic form.
<p>
Each inner list gives a set of equivalent repeats and should have length
equal to the order of the axis' operator.
@param level
@param firstRepeat
@return
499540
public List<List<Integer>> getRepeatsCyclicForm(int level, int firstRepeat) {
		Axis axis = axes.get(level);
		int m = getNumRepeats(level+1);//size of the children
		int d = axis.getOrder(); // degree of this node
		int n = m*d; // number of repeats included
		if(firstRepeat % n != 0) {
			throw new IllegalArgumentException(String.format("Repeat %d cannot start a block at level %s of this tree",firstRepeat,level));
		}
		if(axis.getSymmType() == SymmetryType.OPEN) {
			n -= m; // leave off last child for open symm
		}

		List<List<Integer>> repeats = new ArrayList<>(m);
		for(int i=0;i<m;i++) {
			List<Integer> cycle = new ArrayList<>(d);
			for(int j=0;j<d;j++) {
				cycle.add(firstRepeat+i+j*m);
			}
			repeats.add(cycle);
		}
		return repeats;
	}
618495
public ScaleLevel level(int minMarkers, int maxMarkers)
    {
        Iterator<ScaleLevel> iterator = scale.iterator(min, max);
        ScaleLevel level = iterator.next();
        ScaleLevel prev = null;
        while (iterator.hasNext() && minMarkers > level.count(min, max))
        {
            prev = level;
            level = iterator.next();
        }
        if (maxMarkers < level.count(min, max))
        {
            return prev;
        }
        else
        {
            return level;
        }
    }
18573
public Matrix4d getRepeatTransform(int repeat){

		Matrix4d transform = new Matrix4d();
		transform.setIdentity();

		int[] counts = getAxisCounts(repeat);

		for(int t = counts.length-1; t>=0; t--) {
			if( counts[t] == 0 )
				continue;
			Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
			for(int i=0;i<counts[t];i++) {
				transform.mul(axis);
			}
		}
		return transform;
	}
657382
private int nextTopLevelArgStart(int partIndex) {
        if (partIndex != 0) {
            partIndex = msgPattern.getLimitPartIndex(partIndex);
        }
        for (;;) {
            MessagePattern.Part.Type type = msgPattern.getPartType(++partIndex);
            if (type == MessagePattern.Part.Type.ARG_START) {
                return partIndex;
            }
            if (type == MessagePattern.Part.Type.MSG_LIMIT) {
                return -1;
            }
        }
    }
849626
public static int indexOfPattern(
      final byte[] byteArray,
      final int byteArrayLen,
      final byte[] pattern,
      final int patternLen) {
    Preconditions.checkNotNull(byteArray);
    Preconditions.checkNotNull(pattern);
    if (patternLen > byteArrayLen) {
      return -1;
    }

    byte first = pattern[0];
    int max = byteArrayLen - patternLen;

    for (int i = 0; i <= max; i++) {
      // Look for first byte
      if (byteArray[i] != first) {
        while (++i <= max && byteArray[i] != first) {
        }
      }

      // Found first byte, now look for the rest
      if (i <= max) {
        int j = i + 1;
        int end = j + patternLen - 1;
        for (int k = 1; j < end && byteArray[j] == pattern[k]; j++, k++) {
        }

        if (j == end) {
          // found whole pattern
          return i;
        }
      }
    }
    return -1;
  }
530506
public final int getIndexOfChild(Node child) {
    Node n = first;
    int i = 0;
    while (n != null) {
      if (child == n) {
        return i;
      }

      n = n.next;
      i++;
    }
    return -1;
  }
340397
public static INDArray firstIndex(INDArray array, Condition condition, int... dimension) {
        if (!(condition instanceof BaseCondition))
            throw new UnsupportedOperationException("Only static Conditions are supported");

        return Nd4j.getExecutioner().exec(new FirstIndex(array, condition, dimension));
    }
760087
public static <T> ImmutableMap<T, Integer> itemToIndexMapStartingFrom(final Iterable<T> sequence,
      int startFrom) {
    final ImmutableMap.Builder<T, Integer> ret = ImmutableMap.builder();

    int idx = startFrom;
    for (final T item : sequence) {
      ret.put(item, idx);
      ++idx;
    }

    return ret.build();
  }
962842
public static Pattern repeat(Pattern pattern, int min, int max)
   {
      if (pattern == null)
      {
         throw new IllegalArgumentException("Pattern can not be null");
      }
      return new RepeatPattern(pattern, min, max);
   }
772131
function repetition() {
    var ret = this.seq(this.mightf(repeat), element);
    if (ret[1]) {
        return new ast.Repetition(ret[1], ret[2]);
    }
    return ret[2];
}
55997
public List<StructureIdentifier> getRepeatsID() throws StructureException {

		if (!isRefined())
			return null;

		List<StructureIdentifier> repeats = new ArrayList<StructureIdentifier>(
				numRepeats);

		String pdbId = structureId.toCanonical().getPdbId();
		Block align = multipleAlignment.getBlocks().get(0);

		for (int su = 0; su < numRepeats; su++) {
			// Get the start and end residues of the repeat
			ResidueNumber res1 = atoms[align.getStartResidue(su)].getGroup()
					.getResidueNumber();
			ResidueNumber res2 = atoms[align.getFinalResidue(su)].getGroup()
					.getResidueNumber();
			ResidueRange range = new ResidueRange(res1.getChainName(), res1, res2);

			StructureIdentifier id = new SubstructureIdentifier(pdbId,
					Arrays.asList(range));

			repeats.add(id);
		}
		return repeats;
	}
771228
def firstChild(hot_map, index):
        '''  '''
        children = hot_map[index][2]
        if children:
            return children[0][1]
        else:
            return hot_map[index][1]
402109
public int[] getChildIndexes(int index) {
    if (index == 0) {
      if (isConstant()) {
        return new int[0];
      } else {
        int[] result = new int[subexpressions.size()];
        int startIndex = 1;
        for (int i = 0; i < subexpressions.size(); i++) {
          result[i] = startIndex;
          startIndex += subexpressions.get(i).size();
        }
        return result;
      }
    } else {
      int[] parts = findSubexpression(index);
      int[] result = subexpressions.get(parts[0]).getChildIndexes(parts[1]);
      for (int i = 0; i < result.length; i++) {
        result[i] += parts[2];
      }
      return result;
    }
  }
1367561
public static <T> ImmutableMap<T, Integer> itemToIndexMap(final Iterable<T> sequence) {
    return itemToIndexMapStartingFrom(sequence, 0);
  }
546468
public int indexOf(int[] sequence) {
        int index = -1;
        for (int i = 0; index == -1 && i <= currentSize - sequence.length;
             i++) {
            if (buffer[i] == sequence[0]) {
                boolean matches = true;
                for (int j = 1; matches && j < sequence.length; j++) {
                    if (buffer[i + j] != sequence[j]) {
                        matches = false;
                    }
                }
                if (matches) {
                    index = i;
                }
            }
        }
        return index;
    }
653182
public static String repeat(String s, int count) {
      if (s == null) {
         return null;
      }
      StringBuilder builder = new StringBuilder();
      for (int i = 0; i < count; i++) {
         builder.append(s);
      }
      return builder.toString();
   }
1144003
def _repeat(self, index, stage, stop):
        
        times = None
        if 'iterations' in stage.kwargs:
            times = stage.kwargs['iterations'] - 1
        stages_back = 1
        if 'stages' in stage.kwargs:
            stages_back = stage.kwargs['stages']
        i = 0
        while i != times:
            if stop.is_set():
                break
            for forward in range(stages_back):
                if stop.is_set():
                    break
                stage_index = index - stages_back + forward
                self._execute_stage(stage_index, self._pipe[stage_index], stop)
            i += 1