1 package org.lcsim.detector.identifier; 2 3 /** 4 * IIdentifierContext defines a set of Identifier field indices that are 5 * applicable in a given context, such as a certain level of the 6 * detector hierarchy. The simplest way to define it is with start and end indices. 7 * It can also be defined as a set of index values that do not constitute a range. 8 * If a set of index values is found to constitute a range at construction 9 * time, then it will be treated as such, and {@link #isRange()} will return 10 * <code>true</code>. 11 * 12 * @author Jeremy McCormick 13 * @version $Id: IIdentifierContext.java,v 1.2 2010/04/14 18:49:52 jeremy Exp $ 14 */ 15 public interface IIdentifierContext 16 { 17 /** 18 * The set of discrete indices in this range. 19 * @return Int array of indices. 20 */ 21 int[] getIndices(); 22 23 /** 24 * The start index. 25 * @return The start index. 26 */ 27 int getStartIndex(); 28 29 /** 30 * The end index. 31 * @return The end index. 32 */ 33 int getEndIndex(); 34 35 /** 36 * Does this IdContext constitution a contiguous block of fields between 37 * the start and end indices? 38 * @return True if this is a range; false if not. 39 */ 40 boolean isRange(); 41 42 /** 43 * Check if <code>index</code> is within this context. 44 * @param index 45 * @return True if index is within this context; false if not. 46 */ 47 boolean isValidIndex(int index); 48 49 /** 50 * The number of indices. 51 * @return The number of indices. 52 */ 53 int getNumberOfIndices(); 54 55 /** 56 * Get the index at position <code>i</code>. 57 * @param i 58 * @return The index at position <code>i</code>. 59 * @throws IllegalArgumentException if <code>i</code> is out of range. 60 */ 61 int getIndex(int i); 62 }