With_underscores may be easier to read but all the other methods use camelCase ... which admittedly has the lower-case I / uppercase i confusion.
Another alternative is to change the "safeness" of the index. e.g. myIndex.setSafeIteration(true/false); ~Burn On Thu, Dec 4, 2014 at 11:13 AM, Marshall Schor <[email protected]> wrote: > I'm working on providing UIMA will some new iterators that allow arbitrary > index > modifications while you're iterating; they do this by essentially > "copying" the > state of the index when the iterator is created, and using that copy in a > read-only mode to do the iteration, thus allowing the original indices to > be > updated while iterating (the iterator won't see those index updates). > > This supports use cases such as iterating over some FSs of some type, and > removing some of them, updating them and adding them back, etc. > > I'm thinking various alternatives for specifying this kind of iterator. To > preserve the ability of using the Java extended "for" statement: > > for (FeatureStructure fs : myIndex) > > where myIndex is of type FSIndex, I'm thinking of having a new method in > FSIndex, which will produce a light-weight FSIndex object which operates > like a > base FSIndex object, except that it produces these new kinds of iterators. > This is as-opposed-to a new iterator() method, because the Iterable > interface > makes use of the iterator() method... > > The method to specify that the new iterators for an existing FSIndex would > be > something like "withSnapshotIterators()". You would use it like this: > > FSIndex myNormalIndex = myIndexRepository.getIndex("myIndexName"); > > FSIndex snapshotVersionOfIndex = myNormalIndex.withSnapshotIterators(); > > Some observations: > The withSnapshotIterators could "update" the FSIndex object, or create > a new > (lightweight) copy of it with the new configuration. > - Which should it do? It seems that making a (very light-weight) > copy > would be safer, so I'm leaning that way > > The forms could of course be combined: > e.g.: for (FeatureStructure fs : > indexRepo.getIndex("foo").withSnapshotIterators) .... > > Another way of writing this is: > with_snapshot_iterators() There have been studies that this is > easier to > read, and it seems that way to me... > > The "with...." part in the name seem good (to me) because it implies you > still > have an FSIndex; only the iterator part is changed (which is the case). > > WDYT? > > -Marshall >
