/** * Parses string expression and returns indices. * * @param expression string representation of indices * @return integer indices * @throws IllegalArgumentException if string does not represent correct indices object. */ public static SimpleIndices parseSimple(String expression) { return IndicesFactory.createSimple(null, parse(expression)); }
else if (c == '_' && level == 0) { if (endIndex != 0) parse(expression.substring(beginIndex + 1, endIndex), indices, state); state = 0; beginIndex = endIndex; throw new BracketsError(); if (endIndex != 0) parse(expression.substring(beginIndex + 1, endIndex), indices, state); state = 0x80000000; beginIndex = endIndex; throw new BracketsError(); if (beginIndex != endIndex) parse(expression.substring(beginIndex + 1, endIndex), indices, state); return indices.toArray();
/** * Parses string expression and returns indices allowing repeated indices with same states (like T_ii): appropriate * raising or lowering will be performed automatically. * * @param expression string representation of indices * @return integer indices * @throws IllegalArgumentException if string does not represent correct indices object. */ public static SimpleIndices parseSimpleIgnoringVariance(String expression) { int[] indices = parse(expression); out: for (int i = 0; i < indices.length - 1; ++i) for (int j = i + 1; j < indices.length; ++j) if (indices[i] == indices[j]) { indices[i] = IndicesUtils.inverseIndexState(indices[i]); continue out; } return IndicesFactory.createSimple(null, indices); }