You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2023/09/18 14:24:10 UTC
[uima-uimaj] 01/01: Issue #350: Clean up and modernize code
This is an automated email from the ASF dual-hosted git repository.
rec pushed a commit to branch refactoring/350-Clean-up-and-modernize-code
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git
commit fcee508d926da293ed87f9efc0a0f0a89e89151c
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Mon Sep 18 16:24:01 2023 +0200
Issue #350: Clean up and modernize code
- Use var in various places
- Better use of assertj
- Better use of try-with-resources
- Clean up JavaDoc
- Use more modern Java APIs
- Use more generics and remove warnings
- Remove use of "this." where not necessary
- Formatting
- Fix typos
- Remove unused code
---
.../uima/adapter/vinci/CASTransportable.java | 22 +-
.../vinci/VinciAnalysisEngineServiceAdapter.java | 2 +-
.../vinci/VinciAnalysisEngineServiceStub.java | 15 +-
.../vinci/VinciAnalysisEngineService_impl.java | 4 +-
.../VinciBinaryAnalysisEngineServiceStub.java | 19 +-
.../VinciBinaryAnalysisEngineService_impl.java | 6 +-
.../uima/adapter/vinci/util/NetworkUtil.java | 11 +-
.../adapter/vinci/util/SaxVinciFrameBuilder.java | 9 +-
.../main/java/org/apache/uima/I18nExceptionI.java | 2 +-
.../main/java/org/apache/uima/UIMAException.java | 8 +-
.../uima/analysis_engine/asb/impl/ASB_impl.java | 2 +-
.../asb/impl/FlowControllerContainer.java | 2 +-
.../impl/AggregateAnalysisEngine_impl.java | 10 +-
.../impl/AnalysisEngineDescription_impl.java | 12 +-
.../impl/AnalysisEngineImplBase.java | 4 +-
.../impl/AnalysisEngineManagementImpl.java | 4 +-
.../impl/MultiprocessingAnalysisEngine_impl.java | 2 +-
.../impl/PearAnalysisEngineWrapper.java | 52 ++-
.../impl/PrimitiveAnalysisEngine_impl.java | 12 +-
.../impl/ResultSpecification_impl.java | 5 +-
.../apache/uima/analysis_engine/impl/RsFeat.java | 4 +-
.../apache/uima/analysis_engine/impl/RsLangs.java | 9 +-
.../uima/analysis_engine/impl/RsTypesMap.java | 5 +-
.../analysis_engine/impl/TypeOrFeature_impl.java | 7 +-
.../impl/UimacppAnalysisEngineImpl.java | 8 +-
.../src/main/java/org/apache/uima/cas/CAS.java | 14 +-
.../main/java/org/apache/uima/cas/impl/AllFSs.java | 6 +-
.../uima/cas/impl/AnnotationImplException.java | 24 +-
.../apache/uima/cas/impl/AnnotationTreeImpl.java | 2 +-
.../uima/cas/impl/AnnotationTreeNodeImpl.java | 24 +-
.../org/apache/uima/cas/impl/BinaryCasSerDes.java | 53 +--
.../org/apache/uima/cas/impl/BinaryCasSerDes4.java | 129 +++---
.../org/apache/uima/cas/impl/BinaryCasSerDes6.java | 129 +++---
.../apache/uima/cas/impl/BooleanConstraint.java | 10 +-
.../java/org/apache/uima/cas/impl/ByteHeap.java | 12 +-
.../uima/cas/impl/CASCompleteSerializer.java | 8 +-
.../java/org/apache/uima/cas/impl/CASImpl.java | 287 +++++++------
.../org/apache/uima/cas/impl/CASMgrSerializer.java | 110 ++---
.../org/apache/uima/cas/impl/CASSerializer.java | 63 ++-
.../java/org/apache/uima/cas/impl/CasCompare.java | 26 +-
.../org/apache/uima/cas/impl/CasSeqAddrMaps.java | 8 +-
.../apache/uima/cas/impl/CasSerializerSupport.java | 52 +--
.../apache/uima/cas/impl/CasTypeSystemMapper.java | 4 +-
.../org/apache/uima/cas/impl/CommonAuxHeap.java | 8 +-
.../uima/cas/impl/CommonSerDesSequential.java | 2 +-
.../uima/cas/impl/ConjunctiveConstraint.java | 4 +-
.../uima/cas/impl/DisjunctiveConstraint.java | 4 +-
.../apache/uima/cas/impl/EmbeddedConstraint.java | 8 +-
.../uima/cas/impl/FSBooleanConstraintImpl.java | 6 +-
.../org/apache/uima/cas/impl/FSClassRegistry.java | 7 +-
.../uima/cas/impl/FSFloatConstraintImpl.java | 48 +--
.../uima/cas/impl/FSIndexComparatorImpl.java | 64 +--
.../uima/cas/impl/FSIndexRepositoryImpl.java | 215 +++++-----
.../apache/uima/cas/impl/FSIntConstraintImpl.java | 50 +--
.../uima/cas/impl/FSStringConstraintImpl.java | 12 +-
.../apache/uima/cas/impl/FSTypeConstraintImpl.java | 4 +-
.../java/org/apache/uima/cas/impl/FeatureImpl.java | 58 ++-
.../org/apache/uima/cas/impl/FeaturePathImpl.java | 90 ++--
.../uima/cas/impl/FeatureStructureImplC.java | 22 +-
.../apache/uima/cas/impl/FeatureValuePathImpl.java | 452 ++++++++++-----------
.../org/apache/uima/cas/impl/FilteredIterator.java | 26 +-
.../org/apache/uima/cas/impl/FloatConstraint.java | 12 +-
.../java/org/apache/uima/cas/impl/FsIndex_bag.java | 14 +-
.../org/apache/uima/cas/impl/FsIndex_flat.java | 2 +-
.../org/apache/uima/cas/impl/FsIndex_iicp.java | 16 +-
.../apache/uima/cas/impl/FsIndex_set_sorted.java | 14 +-
.../apache/uima/cas/impl/FsIndex_singletype.java | 38 +-
.../org/apache/uima/cas/impl/FsIndex_snapshot.java | 2 +-
.../apache/uima/cas/impl/FsIterator_backwards.java | 2 +-
.../org/apache/uima/cas/impl/FsIterator_bag.java | 2 +-
.../apache/uima/cas/impl/FsIterator_bag_pear.java | 2 +-
.../apache/uima/cas/impl/FsIterator_limited.java | 6 +-
.../uima/cas/impl/FsIterator_multiple_indexes.java | 6 +-
.../uima/cas/impl/FsIterator_set_sorted_pear.java | 2 +-
.../uima/cas/impl/FsIterator_singletype.java | 2 +-
.../uima/cas/impl/FsIterator_subtypes_ordered.java | 102 ++---
.../cas/impl/FsIterator_subtypes_snapshot.java | 16 +-
.../main/java/org/apache/uima/cas/impl/Heap.java | 84 ++--
.../main/java/org/apache/uima/cas/impl/Id2FS.java | 7 +-
.../org/apache/uima/cas/impl/IntConstraint.java | 12 +-
.../uima/cas/impl/LinearTypeOrderBuilderImpl.java | 74 ++--
.../java/org/apache/uima/cas/impl/LongHeap.java | 12 +-
.../java/org/apache/uima/cas/impl/LongSet.java | 2 +-
.../apache/uima/cas/impl/LowLevelException.java | 2 +-
.../java/org/apache/uima/cas/impl/MarkerImpl.java | 4 +-
.../org/apache/uima/cas/impl/PathConstraint.java | 6 +-
.../org/apache/uima/cas/impl/SelectFSs_impl.java | 96 ++---
.../java/org/apache/uima/cas/impl/ShortHeap.java | 12 +-
.../org/apache/uima/cas/impl/StringConstraint.java | 12 +-
.../java/org/apache/uima/cas/impl/StringHeap.java | 32 +-
.../java/org/apache/uima/cas/impl/StringSet.java | 2 +-
.../java/org/apache/uima/cas/impl/Subiterator.java | 118 +++---
.../java/org/apache/uima/cas/impl/TypeImpl.java | 104 +++--
.../org/apache/uima/cas/impl/TypeImpl_array.java | 4 +-
.../org/apache/uima/cas/impl/TypeImpl_string.java | 2 +-
.../apache/uima/cas/impl/TypeNameSpaceImpl.java | 2 +-
.../org/apache/uima/cas/impl/TypeSystemImpl.java | 55 ++-
.../org/apache/uima/cas/impl/TypeSystemUtils.java | 25 +-
.../org/apache/uima/cas/impl/XCASDeserializer.java | 134 +++---
.../apache/uima/cas/impl/XCASParsingException.java | 2 +-
.../org/apache/uima/cas/impl/XCASSerializer.java | 8 +-
.../apache/uima/cas/impl/XmiCasDeserializer.java | 158 +++----
.../org/apache/uima/cas/impl/XmiCasSerializer.java | 5 +-
.../uima/cas/impl/XmiSerializationSharedData.java | 26 +-
.../java/org/apache/uima/cas/text/Language.java | 24 +-
.../apache/uima/cas_data/impl/CasDataToXCas.java | 4 +-
.../cas_data/impl/XCasToCasDataSaxHandler.java | 86 ++--
.../uima/flow/impl/FlowControllerContext_impl.java | 2 +-
.../org/apache/uima/internal/util/BinaryTree.java | 28 +-
.../uima/internal/util/CharArraySpanMap.java | 40 +-
.../apache/uima/internal/util/CharArrayString.java | 96 ++---
.../org/apache/uima/internal/util/Class_TCCL.java | 21 +-
.../uima/internal/util/CommandLineParser.java | 36 +-
.../uima/internal/util/Common_hash_support.java | 26 +-
.../uima/internal/util/CopyOnWriteObjHashSet.java | 4 +-
.../util/CopyOnWriteOrderedFsSet_array.java | 14 +-
.../uima/internal/util/EncodedPrintStream.java | 1 +
.../java/org/apache/uima/internal/util/Graph.java | 2 +-
.../org/apache/uima/internal/util/GraphNode.java | 20 +-
.../org/apache/uima/internal/util/I18nx_impl.java | 2 +-
.../apache/uima/internal/util/Int2ObjHashMap.java | 10 +-
.../org/apache/uima/internal/util/IntHashSet.java | 4 +-
.../java/org/apache/uima/internal/util/IntSet.java | 28 +-
.../org/apache/uima/internal/util/IntStack.java | 12 +-
.../org/apache/uima/internal/util/IntVector.java | 155 ++++---
.../uima/internal/util/Obj2IntIdentityHashMap.java | 10 +-
.../org/apache/uima/internal/util/ObjHashSet.java | 8 +-
.../uima/internal/util/OrderedFsSet_array.java | 16 +-
.../uima/internal/util/OrderedFsSet_array2.java | 55 ++-
.../java/org/apache/uima/internal/util/Pair.java | 5 +-
.../uima/internal/util/ReplaceStringInFiles.java | 4 +-
.../uima/internal/util/SerializationUtils.java | 194 ++++++++-
.../apache/uima/internal/util/SortedIntSet.java | 28 +-
.../apache/uima/internal/util/StringToIntMap.java | 10 +-
.../org/apache/uima/internal/util/SymbolTable.java | 32 +-
.../uima/internal/util/TextStringTokenizer.java | 108 ++---
.../apache/uima/internal/util/TextTokenizer.java | 100 ++---
.../org/apache/uima/internal/util/TimeSpan.java | 118 +++---
.../java/org/apache/uima/internal/util/Timer.java | 28 +-
.../uima/internal/util/UIMAStreamHandler.java | 2 +-
.../org/apache/uima/internal/util/UtilError.java | 20 +-
.../internal/util/rb_trees/CompIntArrayRBT.java | 2 +-
.../uima/internal/util/rb_trees/Int2IntRBT.java | 94 ++---
.../uima/internal/util/rb_trees/IntArrayRBT.java | 86 ++--
.../internal/util/rb_trees/IntArrayRBTcommon.java | 140 +++----
.../uima/internal/util/rb_trees/IntRBTArray.java | 22 +-
.../uima/internal/util/rb_trees/IntRBTNode.java | 64 +--
.../internal/util/rb_trees/IntRedBlackTree.java | 54 +--
.../internal/util/rb_trees/RBTKeyValuePair.java | 4 +-
.../uima/internal/util/rb_trees/RBTNode.java | 74 ++--
.../uima/internal/util/rb_trees/RedBlackTree.java | 50 +--
.../src/main/java/org/apache/uima/jcas/JCas.java | 38 +-
.../java/org/apache/uima/jcas/cas/CommonList.java | 6 +-
.../java/org/apache/uima/jcas/cas/FSArrayList.java | 43 ++
.../org/apache/uima/jcas/cas/FSLinkedHashSet.java | 1 -
.../main/java/org/apache/uima/jcas/cas/FSList.java | 4 +-
.../java/org/apache/uima/jcas/cas/FloatList.java | 4 +-
.../org/apache/uima/jcas/cas/IntegerArrayList.java | 3 +
.../java/org/apache/uima/jcas/cas/IntegerList.java | 4 +-
.../apache/uima/jcas/cas/NonEmptyFloatList.java | 2 +-
.../java/org/apache/uima/jcas/cas/StringList.java | 6 +-
.../java/org/apache/uima/jcas/cas/TOP_Type.java | 14 +-
.../java/org/apache/uima/jcas/impl/JCasImpl.java | 14 +-
.../uima/jcas/impl/JFSIndexRepositoryImpl.java | 4 +-
.../java/org/apache/uima/jcas/tcas/Annotation.java | 6 +-
.../uima/pear/tools/InstallationController.java | 14 +-
.../apache/uima/pear/tools/InstallationTester.java | 32 +-
.../org/apache/uima/pear/tools/PackageBrowser.java | 8 +-
.../java/org/apache/uima/pear/util/FileUtil.java | 6 +-
.../org/apache/uima/pear/util/ProcessUtil.java | 2 +-
.../org/apache/uima/resource/CasDefinition.java | 20 +-
.../impl/ConfigurableDataResource_impl.java | 9 +-
.../impl/ConfigurationManagerImplBase.java | 4 +-
.../uima/resource/impl/DataResource_impl.java | 7 +-
.../apache/uima/resource/impl/Parameter_impl.java | 4 +-
.../uima/resource/impl/PearSpecifier_impl.java | 16 +-
.../resource/impl/RelativePathResolver_impl.java | 10 +-
.../uima/resource/impl/ResourceManager_impl.java | 16 +-
.../impl/ConfigurationParameterSettings_impl.java | 2 +-
.../metadata/impl/ConfigurationParameter_impl.java | 2 +-
.../resource/metadata/impl/ImportResolver.java | 5 +-
.../uima/resource/metadata/impl/Import_impl.java | 2 +-
.../metadata/impl/LanguagePrecondition_impl.java | 4 +-
.../metadata/impl/MetaDataObject_impl.java | 15 +-
.../impl/ResourceManagerConfiguration_impl.java | 16 +-
.../uima/uimacpp/UimacppAnalysisComponent.java | 18 +-
.../org/apache/uima/util/CasCreationUtils.java | 4 +-
.../main/java/org/apache/uima/util/CasIOUtils.java | 80 ++--
.../java/org/apache/uima/util/CasLoadMode.java | 6 +-
.../main/java/org/apache/uima/util/IntEntry.java | 8 +-
.../src/main/java/org/apache/uima/util/Level.java | 4 +-
.../java/org/apache/uima/util/NameClassPair.java | 8 +-
.../java/org/apache/uima/util/XMLInputSource.java | 12 +-
.../apache/uima/util/impl/JSR47Logger_impl.java | 4 +-
.../apache/uima/util/impl/Log4jLogger_impl.java | 8 +-
.../apache/uima/util/impl/Logger_common_impl.java | 12 +-
.../org/apache/uima/util/impl/Logger_impl.java | 6 +-
.../apache/uima/util/impl/Slf4jLogger_impl.java | 4 +-
.../uima/ae/multiplier/SimpleCasGenerator.java | 12 +-
.../impl/AnalysisEngineDescription_implTest.java | 255 ++++++------
.../analysis_engine/impl/AnnotationWriter.java | 20 +-
.../impl/AnnotatorContext_implTest.java | 6 +-
.../impl/PearAnalysisEngineWrapperTest.java | 34 +-
.../impl/ResultSpecification_implTest.java | 4 +-
.../impl/SegmentDroppingFlowController.java | 5 +-
.../impl/TaeDescription_implTest.java | 41 +-
.../impl/metadata/SofaMapping_implTest.java | 38 +-
.../sequencer/SequencerCapabilityLanguageTest.java | 4 +-
.../impl/sequencer/SequencerFixedTest.java | 16 +-
.../impl/sequencer/SequencerTestAnnotator.java | 8 +-
.../uima/cas/impl/AnnotationIteratorTest.java | 130 +++---
.../uima/cas/impl/CasTypeSystemMapperTest.java | 6 +-
.../impl/ConcurrentBinarySerializationTest.java | 2 +-
.../java/org/apache/uima/cas/impl/Id2FSTest.java | 6 +-
.../org/apache/uima/cas/impl/SerDesForm4Test.java | 2 +-
.../org/apache/uima/cas/impl/SerDesForm6Test.java | 2 +-
.../apache/uima/cas/impl/XmiCasSerializerTest.java | 24 +-
.../uima/cas/serdes/CasToComparableText.java | 16 +-
.../uima/cas/serdes/PerformanceTestRunner.java | 16 +-
.../uima/cas/serdes/SerDesCasIOTestUtils.java | 13 +-
.../datasuites/MultiTypeRandomCasDataSuite.java | 6 +-
.../generators/MultiTypeRandomCasGenerator.java | 14 +-
.../cas/serdes/scenario/DesSerTestScenario.java | 16 +-
.../cas/serdes/scenario/SerRefTestScenario.java | 14 +-
.../transitions/CasSourceTargetConfiguration.java | 8 +-
.../java/org/apache/uima/cas/test/ArrayFSTest.java | 50 +--
.../org/apache/uima/cas/test/ArrayIndexTest.java | 6 +-
.../java/org/apache/uima/cas/test/CASTest.java | 22 +-
.../java/org/apache/uima/cas/test/FeatureMap.java | 2 +-
.../apache/uima/cas/test/FilteredIteratorTest.java | 74 ++--
.../org/apache/uima/cas/test/FloatArrayFSTest.java | 14 +-
.../apache/uima/cas/test/GetAllIndexedTest.java | 66 +--
.../cas/test/GrowingTheCasNoJcasCacheTest.java | 24 +-
.../apache/uima/cas/test/GrowingTheCasTest.java | 34 +-
.../apache/uima/cas/test/IndexComparitorTest.java | 10 +-
.../uima/cas/test/IndexRepositoryMergingTest.java | 6 +-
.../apache/uima/cas/test/IndexRepositoryTest.java | 50 +--
.../org/apache/uima/cas/test/IntArrayFSTest.java | 14 +-
.../org/apache/uima/cas/test/IteratorTest.java | 230 +++++------
.../java/org/apache/uima/cas/test/SofaTest.java | 162 ++++----
.../org/apache/uima/cas/test/StringArrayTest.java | 32 +-
.../apache/uima/cas/test/StringSubtypeTest.java | 14 +-
.../org/apache/uima/cas/test/SubiteratorTest.java | 12 +-
.../org/apache/uima/cas/test/TypeOrderTest.java | 64 +--
.../org/apache/uima/cas/test/TypeSystemTest.java | 110 ++---
.../apache/uima/cas/test/TypeSystemUtilsTest.java | 8 +-
.../uima/cas/test/UimacppDeserializationTest.java | 84 ----
.../uima/cas_data/impl/CasDataToXCasTest.java | 8 +-
.../impl/CasConsumerDescription_implTest.java | 258 +++++-------
.../impl/CasInitializerDescription_implTest.java | 274 ++++++-------
.../impl/CollectionReaderDescription_implTest.java | 263 +++++-------
.../uima/internal/util/SerializationUtilsTest.java | 187 +++++++++
.../uima/internal/util/UIMAClassLoaderTest.java | 12 +-
.../org/apache/uima/jcas/impl/JCasHashMapTest.java | 2 +-
.../org/apache/uima/jcas/test/FSArrayListTest.java | 6 +-
.../org/apache/uima/jcas/test/FSHashSetTest.java | 4 +-
.../uima/jcas/test/IntegerArrayListTest.java | 6 +-
.../java/org/apache/uima/jcas/test/JCasTest.java | 16 +-
.../apache/uima/pear/util/PearInstallerTest.java | 12 +-
.../org/apache/uima/pear/util/PearRuntimeTest.java | 14 +-
.../uima/resource/impl/PearSpecifier_implTest.java | 104 +++--
.../uima/resource/impl/URISpecifier_implTest.java | 35 +-
.../resource/metadata/impl/Import_implTest.java | 200 +++++----
.../metadata/impl/MetaDataObject_implTest.java | 132 +++---
.../java/org/apache/uima/util/CasIOUtilsTest.java | 228 +++++------
.../apache/uima/util/impl/XMLParser_implTest.java | 2 +-
uimaj-cpe/pom.xml | 5 +
.../apache/uima/collection/impl/CasConverter.java | 10 +-
.../uima/collection/impl/cpm/BaseCPMImpl.java | 6 +-
.../apache/uima/collection/impl/cpm/CPEConfig.java | 3 -
.../apache/uima/collection/impl/cpm/CPMImpl.java | 7 +-
.../uima/collection/impl/cpm/Checkpoint.java | 164 ++++----
.../uima/collection/impl/cpm/CheckpointConfig.java | 4 +-
.../uima/collection/impl/cpm/CheckpointData.java | 3 -
.../apache/uima/collection/impl/cpm/Constants.java | 3 -
.../impl/cpm/StatusCallbackListenerImpl.java | 18 +-
.../collection/impl/cpm/container/CPEContext.java | 5 +-
.../collection/impl/cpm/container/CPEFactory.java | 23 +-
.../CasProcessorConfigurationJAXBImpl.java | 98 ++---
.../cpm/container/NetworkCasProcessorImpl.java | 4 +-
.../cpm/container/ProcessingContainer_Impl.java | 8 +-
.../container/deployer/CPEDeployerDefaultImpl.java | 4 +-
.../impl/cpm/container/deployer/VinciTAP.java | 4 +-
.../deployer/vinci/VinciCasProcessorDeployer.java | 8 +-
.../impl/cpm/container/deployer/vns/LocalVNS.java | 4 +-
.../impl/cpm/container/deployer/vns/VNSQuery.java | 2 +-
.../impl/cpm/engine/ArtifactProducer.java | 24 +-
.../collection/impl/cpm/engine/CPECasPool.java | 2 +-
.../uima/collection/impl/cpm/engine/CPMEngine.java | 10 +-
.../impl/cpm/engine/DebugControlThread.java | 2 +-
.../impl/cpm/engine/NonThreadedProcessingUnit.java | 42 +-
.../collection/impl/cpm/engine/ProcessingUnit.java | 50 +--
.../collection/impl/cpm/engine/SequencedQueue.java | 2 +-
.../uima/collection/impl/cpm/utils/CPMUtils.java | 2 +-
.../uima/collection/impl/cpm/utils/Filter.java | 2 +-
.../impl/metadata/cpe/CasProcessorCpeObject.java | 2 +-
.../impl/metadata/cpe/CpeCasProcessorsImpl.java | 2 +-
.../metadata/cpe/CpeLocalCasProcessorImpl.java | 2 +-
.../uima/collection/impl/cpm/CheckpointTest.java | 114 ++++++
.../impl/cpm/CpeDescriptorSerialization_Test.java | 6 +-
.../uima/collection/impl/cpm/CpmAE_ErrorTest.java | 2 +-
.../impl/cpm/CpmCasConsumer_ErrorTest.java | 6 +-
.../impl/cpm/CpmCollectionReader_ErrorTest.java | 8 +-
.../uima/collection/impl/cpm/PearCasPoolTest.java | 4 +-
.../impl/cpm/utils/ErrorTestAnnotator.java | 4 +-
.../examples/cpm/sofa/SofaCollectionReader.java | 2 +-
306 files changed, 5100 insertions(+), 5115 deletions(-)
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/CASTransportable.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/CASTransportable.java
index d965c4767..3f44191cc 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/CASTransportable.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/CASTransportable.java
@@ -89,11 +89,11 @@ public class CASTransportable extends DefaultHandler implements Transportable {
public CASTransportable(CasPool casPool, OutOfTypeSystemData outOfTypeSystemData,
UimaContext uimaContext, boolean includeDocText) {
// Debug.p("Creating new CASTransportable.");
- this.myCasPool = casPool;
- this.myCas = null;
+ myCasPool = casPool;
+ myCas = null;
this.outOfTypeSystemData = outOfTypeSystemData;
this.uimaContext = uimaContext;
- this.extraDataFrame = new VinciFrame();
+ extraDataFrame = new VinciFrame();
this.includeDocText = includeDocText;
}
@@ -113,11 +113,11 @@ public class CASTransportable extends DefaultHandler implements Transportable {
public CASTransportable(CAS cas, OutOfTypeSystemData outOfTypeSystemData, UimaContext uimaContext,
boolean includeDocText) {
// Debug.p("Creating new CASTransportable.");
- this.myCas = cas;
- this.myCasPool = null;
+ myCas = cas;
+ myCasPool = null;
this.outOfTypeSystemData = outOfTypeSystemData;
this.uimaContext = uimaContext;
- this.extraDataFrame = new VinciFrame();
+ extraDataFrame = new VinciFrame();
this.includeDocText = includeDocText;
}
@@ -136,7 +136,7 @@ public class CASTransportable extends DefaultHandler implements Transportable {
* @return the out of type system data
*/
public OutOfTypeSystemData getOutOfTypeSystemData() {
- return this.outOfTypeSystemData;
+ return outOfTypeSystemData;
}
/**
@@ -190,7 +190,7 @@ public class CASTransportable extends DefaultHandler implements Transportable {
*/
XTalkSerializer(OutputStream os, XCASSerializer s) {
this.os = os;
- this.serializer = s;
+ serializer = s;
}
/*
@@ -359,7 +359,7 @@ public class CASTransportable extends DefaultHandler implements Transportable {
public void toStream(OutputStream os) throws IOException {
try {
UIMAFramework.getLogger().log(Level.FINEST, "Serializing CAS.");
- XCASSerializer xcasSerializer = new XCASSerializer(myCas.getTypeSystem(), this.uimaContext);
+ XCASSerializer xcasSerializer = new XCASSerializer(myCas.getTypeSystem(), uimaContext);
// Not sure why we need to do the next two lines:
xcasSerializer.setDocumentTypeName(Constants.VINCI_DETAG);
xcasSerializer.setDocumentTextFeature(null);
@@ -442,7 +442,7 @@ public class CASTransportable extends DefaultHandler implements Transportable {
myCas = myCasPool.getCas(0);
}
myCas.reset();
- XCASDeserializer deser = new XCASDeserializer(myCas.getTypeSystem(), this.uimaContext);
+ XCASDeserializer deser = new XCASDeserializer(myCas.getTypeSystem(), uimaContext);
deser.setDocumentTypeName("Detag:DetagContent");
if (!ignoreResponse) {
handler = deser.getXCASHandler(myCas, outOfTypeSystemData);
@@ -506,7 +506,7 @@ public class CASTransportable extends DefaultHandler implements Transportable {
*/
@Override
public void startDocument() throws SAXException {
- this.ready = 0;
+ ready = 0;
}
/*
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceAdapter.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceAdapter.java
index 39bb6c990..52c0b8dfe 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceAdapter.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceAdapter.java
@@ -48,7 +48,7 @@ public class VinciAnalysisEngineServiceAdapter extends AnalysisEngineServiceAdap
* @see org.apache.uima.resource.Resource#initialize(ResourceSpecifier, Map)
*/
@Override
- public boolean initialize(ResourceSpecifier aSpecifier, Map aAdditionalParams)
+ public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
throws ResourceInitializationException {
// aSpecifier must be a URISpecifier
if (!(aSpecifier instanceof URISpecifier)) {
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceStub.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceStub.java
index 387a70410..4bb0a4c81 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceStub.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineServiceStub.java
@@ -19,6 +19,9 @@
package org.apache.uima.adapter.vinci;
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
+
import java.net.InetAddress;
import java.util.Arrays;
import java.util.Collections;
@@ -54,11 +57,8 @@ import org.apache.vinci.transport.document.AFrame;
*/
public class VinciAnalysisEngineServiceStub implements AnalysisEngineServiceStub {
- /** The m vinci client. */
- private VinciClient mVinciClient;
-
- /** The m owner. */
- private Resource mOwner;
+ private final VinciClient mVinciClient;
+ private final Resource mOwner;
/**
* Timeout to use for process and collectionProcessComplete calls.
@@ -77,8 +77,7 @@ public class VinciAnalysisEngineServiceStub implements AnalysisEngineServiceStub
* Value to return from callGetSupportedXCasVersions method for older services that don't actually
* implement this method.
*/
- private static final List SUPPORT_XCAS_V1 = Collections
- .unmodifiableList(Arrays.asList(new String[] { "1" }));
+ private static final List<String> SUPPORT_XCAS_V1 = unmodifiableList(asList("1"));
/**
* Instantiates a new vinci analysis engine service stub.
@@ -401,7 +400,7 @@ public class VinciAnalysisEngineServiceStub implements AnalysisEngineServiceStub
* @throws ResourceServiceException
* the resource service exception
*/
- public List callGetSupportedXCasVersions() throws ResourceServiceException {
+ public List<String> callGetSupportedXCasVersions() throws ResourceServiceException {
try {
// create Vinci Frame ( Data Cargo)
AFrame queryFrame = new AFrame();
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineService_impl.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineService_impl.java
index 3e90d0cd2..e8c0af7f5 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineService_impl.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciAnalysisEngineService_impl.java
@@ -210,7 +210,7 @@ public class VinciAnalysisEngineService_impl extends VinciServableAdapter {
// cas.getAnnotationIndex().size());
int totalAnnots = 0;
SofaFS sofa;
- FSIterator sItr = cas.getSofaIterator();
+ FSIterator<SofaFS> sItr = cas.getSofaIterator();
while (sItr.isValid()) {
sofa = (SofaFS) sItr.get();
totalAnnots += cas.getView(sofa).getAnnotationIndex().size();
@@ -246,7 +246,7 @@ public class VinciAnalysisEngineService_impl extends VinciServableAdapter {
String op = ct.getCommand();
if (Constants.GETMETA.equals(op)) {
ct.cleanup();
- return this.getMetaData();
+ return getMetaData();
} else if (Constants.PROCESS_CAS.equals(op) || Constants.ANNOTATE.equals(op)) {
return analyze(ct);
} else if (Constants.BATCH_PROCESS_COMPLETE.equals(op)) {
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineServiceStub.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineServiceStub.java
index 6e6e43389..50cdd6ace 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineServiceStub.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineServiceStub.java
@@ -53,14 +53,10 @@ import org.apache.vinci.transport.document.AFrame;
*/
public class VinciBinaryAnalysisEngineServiceStub implements AnalysisEngineServiceStub {
- /** The Constant debug. */
private static final boolean debug = false;
- /** The m vinci client. */
- private VinciClient mVinciClient;
-
- /** The m owner. */
- private AnalysisEngineServiceAdapter mOwner;
+ private final VinciClient mVinciClient;
+ private final AnalysisEngineServiceAdapter mOwner;
/**
* Timeout to use for process and collectionProcessComplete calls.
@@ -109,6 +105,7 @@ public class VinciBinaryAnalysisEngineServiceStub implements AnalysisEngineServi
// open Vinci connection
try {
VinciContext vctx = new VinciContext(InetAddress.getLocalHost().getCanonicalHostName(), 0);
+
// Override vinci default VNS settings
String vnsHost = null;
String vnsPort = null;
@@ -121,13 +118,15 @@ public class VinciBinaryAnalysisEngineServiceStub implements AnalysisEngineServi
}
if (vnsHost == null) {
vnsHost = System.getProperty("VNS_HOST");
- if (vnsHost == null)
+ if (vnsHost == null) {
vnsHost = Constants.DEFAULT_VNS_HOST;
+ }
}
if (vnsPort == null) {
vnsPort = System.getProperty("VNS_PORT");
- if (vnsPort == null)
+ if (vnsPort == null) {
vnsPort = "9000";
+ }
}
vctx.setVNSHost(vnsHost);
vctx.setVNSPort(Integer.parseInt(vnsPort));
@@ -264,8 +263,8 @@ public class VinciBinaryAnalysisEngineServiceStub implements AnalysisEngineServi
// deserialize CAS from response frame
byte[] responseCasBytes = responseFrame.fgetTrueBinary("BinaryCAS");
- CASSerializer responseSerializer = (CASSerializer) SerializationUtils
- .deserialize(responseCasBytes);
+ CASSerializer responseSerializer = SerializationUtils
+ .deserializeCASSerializer(responseCasBytes);
((CASImpl) cas).getBinaryCasSerDes().reinit(responseSerializer);
// also read annotation time and enter into AnalysisEngineManagementMBean
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineService_impl.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineService_impl.java
index 4f8045682..0535e59ab 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineService_impl.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/VinciBinaryAnalysisEngineService_impl.java
@@ -206,8 +206,8 @@ public class VinciBinaryAnalysisEngineService_impl extends VinciServableAdapter
// deserialize into CAS object
byte[] casBytes = aRequestFrame.fgetTrueBinary("BinaryCAS");
- CASCompleteSerializer serializer = (CASCompleteSerializer) SerializationUtils
- .deserialize(casBytes);
+ CASCompleteSerializer serializer = SerializationUtils
+ .deserializeCASCompleteSerializer(casBytes);
Serialization.deserializeCASComplete(serializer, (CASMgr) cas);
long annotStartTime = System.currentTimeMillis();
@@ -272,7 +272,7 @@ public class VinciBinaryAnalysisEngineService_impl extends VinciServableAdapter
UIMAFramework.getLogger().log(Level.FINEST, "Command::" + op);
if (Constants.GETMETA.equals(op)) {
try {
- return this.getMetaData();
+ return getMetaData();
} catch (Exception ex) {
throw new ServiceException("getMetaData() threw exception: " + ex);
}
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/NetworkUtil.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/NetworkUtil.java
index be9fdc7c7..42b3af3cf 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/NetworkUtil.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/NetworkUtil.java
@@ -24,7 +24,6 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
-import java.util.Enumeration;
// TODO: Auto-generated Javadoc
/**
@@ -44,19 +43,19 @@ public class NetworkUtil {
*/
public static InetAddress getLocalHostAddress() throws UnknownHostException {
// try the straightforward call first
- InetAddress localhost = InetAddress.getLocalHost();
+ var localhost = InetAddress.getLocalHost();
if (!localhost.isLoopbackAddress()) {
return localhost;
}
// the above often fails on Linux. Try enumerating all NetworkInterfaces.
try {
- Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces();
+ var networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
- NetworkInterface networkInterface = (NetworkInterface) networkInterfaces.nextElement();
- Enumeration addresses = networkInterface.getInetAddresses();
+ var networkInterface = (NetworkInterface) networkInterfaces.nextElement();
+ var addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
- InetAddress address = (InetAddress) addresses.nextElement();
+ var address = (InetAddress) addresses.nextElement();
if (address instanceof Inet4Address && !address.isLoopbackAddress()) {
return address;
}
diff --git a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/SaxVinciFrameBuilder.java b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/SaxVinciFrameBuilder.java
index 09dffab4b..2dbc6728f 100644
--- a/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/SaxVinciFrameBuilder.java
+++ b/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/SaxVinciFrameBuilder.java
@@ -36,7 +36,7 @@ import org.xml.sax.helpers.DefaultHandler;
public class SaxVinciFrameBuilder extends DefaultHandler implements ContentHandler {
/** The m open frames. */
- private Stack mOpenFrames;
+ private Stack<AFrame> mOpenFrames;
/** The m current frame name. */
private String mCurrentFrameName;
@@ -55,7 +55,7 @@ public class SaxVinciFrameBuilder extends DefaultHandler implements ContentHandl
* the parent frame
*/
public void setParentFrame(AFrame aParentFrame) {
- mOpenFrames = new Stack();
+ mOpenFrames = new Stack<AFrame>();
mOpenFrames.push(aParentFrame);
}
@@ -219,9 +219,10 @@ public class SaxVinciFrameBuilder extends DefaultHandler implements ContentHandl
* @return s1 if it isn't empty, else s2.
*/
protected String getName(String s1, String s2) {
- if (s1 == null || "".equals(s1))
+ if (s1 == null || "".equals(s1)) {
return s2;
- else
+ } else {
return s1;
+ }
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java b/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java
index a7668b946..1c947f7db 100644
--- a/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java
+++ b/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java
@@ -81,7 +81,7 @@ public interface I18nExceptionI {
* @return true if this exception or any of its root causes has a particular UIMA message key.
*/
default boolean hasMessageKey(String messageKey) {
- if (messageKey.equals(this.getMessageKey())) {
+ if (messageKey.equals(getMessageKey())) {
return true;
}
Throwable cause = getCause();
diff --git a/uimaj-core/src/main/java/org/apache/uima/UIMAException.java b/uimaj-core/src/main/java/org/apache/uima/UIMAException.java
index 9240ad943..513aeb4da 100644
--- a/uimaj-core/src/main/java/org/apache/uima/UIMAException.java
+++ b/uimaj-core/src/main/java/org/apache/uima/UIMAException.java
@@ -128,10 +128,10 @@ public class UIMAException extends Exception implements I18nExceptionI {
public UIMAException(String aResourceBundleName, String aMessageKey, Object[] aArguments,
Throwable aCause) {
super(aCause);
- this.mResourceBundleName = aResourceBundleName;
- this.mMessageKey = aMessageKey;
- this.mArguments = aArguments;
- this.mCause = aCause;
+ mResourceBundleName = aResourceBundleName;
+ mMessageKey = aMessageKey;
+ mArguments = aArguments;
+ mCause = aCause;
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java
index 7fb7dc0ad..33d8a0b8d 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/ASB_impl.java
@@ -742,7 +742,7 @@ public class ASB_impl extends Resource_ImplBase implements ASB {
this.casIterator = casIterator;
this.originalCas = originalCas;
this.originalCasFlow = originalCasFlow;
- this.casMultiplierAeKey = lastAeKey;
+ casMultiplierAeKey = lastAeKey;
this.incompleteParallelStep = incompleteParallelStep;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
index c7e0f7db7..aad24f710 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/asb/impl/FlowControllerContainer.java
@@ -226,7 +226,7 @@ public class FlowControllerContainer extends ConfigurableResource_ImplBase {
Class<? extends AbstractCas> requiredInterface = mFlowController.getRequiredCasInterface();
AbstractCas casToPass = getCasManager().getCasInterface(view, requiredInterface);
((CASImpl) view)
- .switchClassLoaderLockCasCL(this.getResourceManager().getExtensionClassLoader());
+ .switchClassLoaderLockCasCL(getResourceManager().getExtensionClassLoader());
Flow flow = mFlowController.computeFlow(casToPass);
if (flow instanceof CasFlow_ImplBase) {
((CasFlow_ImplBase) flow).setCas(view);
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AggregateAnalysisEngine_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AggregateAnalysisEngine_impl.java
index dc51c11ba..b10d08488 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AggregateAnalysisEngine_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AggregateAnalysisEngine_impl.java
@@ -299,7 +299,7 @@ public class AggregateAnalysisEngine_impl extends AnalysisEngineImplBase impleme
super.reconfigure();
// call this method recursively on each component
- Map<String, AnalysisEngine> components = this._getASB().getComponentAnalysisEngines();
+ Map<String, AnalysisEngine> components = _getASB().getComponentAnalysisEngines();
Iterator<AnalysisEngine> it = components.values().iterator();
while (it.hasNext()) {
ConfigurableResource component = it.next();
@@ -315,7 +315,7 @@ public class AggregateAnalysisEngine_impl extends AnalysisEngineImplBase impleme
enterBatchProcessComplete();
try {
// pass call down to components, which might be (or contain) CAS Consumers
- Iterator<AnalysisEngine> iter = this._getASB().getComponentAnalysisEngines().values()
+ Iterator<AnalysisEngine> iter = _getASB().getComponentAnalysisEngines().values()
.iterator();
while (iter.hasNext()) {
iter.next().batchProcessComplete();
@@ -335,7 +335,7 @@ public class AggregateAnalysisEngine_impl extends AnalysisEngineImplBase impleme
// (a custom FlowController must be in use), the entire order is arbitrary.
String[] orderedNodes = null;
Map<String, AnalysisEngine> components = new HashMap<>(
- this._getASB().getComponentAnalysisEngines());
+ _getASB().getComponentAnalysisEngines());
FlowConstraints flow = getAnalysisEngineMetaData().getFlowConstraints();
if (flow != null) {
if (flow instanceof FixedFlow) {
@@ -414,7 +414,7 @@ public class AggregateAnalysisEngine_impl extends AnalysisEngineImplBase impleme
Map<String, Object> aAdditionalParams) throws ResourceInitializationException {
// add this analysis engine's name to the parameters sent to the ASB
Map<String, Object> asbParams = new HashMap<>(aAdditionalParams);
- asbParams.put(ASB.PARAM_AGGREGATE_ANALYSIS_ENGINE_NAME, this.getMetaData().getName()); // not
+ asbParams.put(ASB.PARAM_AGGREGATE_ANALYSIS_ENGINE_NAME, getMetaData().getName()); // not
// used
// 9/2013
// scan
@@ -506,7 +506,7 @@ public class AggregateAnalysisEngine_impl extends AnalysisEngineImplBase impleme
getResourceManager());
// assign results of merge to this aggregate AE's metadata
- AnalysisEngineMetaData aggregateMD = this.getAnalysisEngineMetaData();
+ AnalysisEngineMetaData aggregateMD = getAnalysisEngineMetaData();
aggregateMD.setTypeSystem(aggTypeDesc);
aggregateMD.setTypePriorities(aggTypePriorities);
aggregateMD.setFsIndexCollection(aggIndexColl);
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_impl.java
index ba5088836..3a4a659ae 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_impl.java
@@ -494,14 +494,14 @@ public class AnalysisEngineDescription_impl extends ResourceCreationSpecifier_im
* -
*/
protected void validateSofaMappings() throws ResourceInitializationException {
- if (this.isPrimitive()) {
+ if (isPrimitive()) {
return;
}
- String aggName = this.getAnalysisEngineMetaData().getName();
+ String aggName = getAnalysisEngineMetaData().getName();
// build an actual Map (key: componentKey@/@componentSofa) from the sofa mappings
// along the way check that all component keys and component sofa names exist
Map<String, String> sofamap = new TreeMap<>();
- SofaMapping[] sofaMappings = this.getSofaMappings();
+ SofaMapping[] sofaMappings = getSofaMappings();
if (sofaMappings != null) {
for (int s = 0; s < sofaMappings.length; s++) {
String componentKey = sofaMappings[s].getComponentKey();
@@ -627,7 +627,7 @@ public class AnalysisEngineDescription_impl extends ResourceCreationSpecifier_im
if (!containsRemote) {
// check that all aggregate outputs and inputs were mapped correclty to
// component inputs/outputs
- Capability[] caps = this.getAnalysisEngineMetaData().getCapabilities();
+ Capability[] caps = getAnalysisEngineMetaData().getCapabilities();
for (int i = 0; i < caps.length; i++) {
String[] sofas = caps[i].getOutputSofas();
for (int j = 0; j < sofas.length; j++) {
@@ -669,7 +669,7 @@ public class AnalysisEngineDescription_impl extends ResourceCreationSpecifier_im
}
protected boolean capabilitiesContainSofa(String aSofaName, boolean aOutput) {
- Capability[] caps = this.getAnalysisEngineMetaData().getCapabilities();
+ Capability[] caps = getAnalysisEngineMetaData().getCapabilities();
for (int i = 0; i < caps.length; i++) {
String[] sofas = aOutput ? caps[i].getOutputSofas() : caps[i].getInputSofas();
for (int j = 0; j < sofas.length; j++) {
@@ -870,7 +870,7 @@ public class AnalysisEngineDescription_impl extends ResourceCreationSpecifier_im
// users who create
// new import objects
if (aeImport instanceof Import_impl) {
- ((Import_impl) aeImport).setSourceUrlIfNull(this.getSourceUrl());
+ ((Import_impl) aeImport).setSourceUrlIfNull(getSourceUrl());
}
// locate import target
URL url = aeImport.findAbsoluteUrl(aResourceManager);
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineImplBase.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineImplBase.java
index a6e948e7b..b76806f52 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineImplBase.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineImplBase.java
@@ -398,7 +398,7 @@ public abstract class AnalysisEngineImplBase extends ConfigurableResource_ImplBa
public synchronized String[] getFeatureNamesForType(String aTypeName) {
// build CAS and populate mFirstTypeSystem
CASImpl cas = (CASImpl) getCasManager()
- .getCas(this.getUimaContextAdmin().getQualifiedContextName());
+ .getCas(getUimaContextAdmin().getQualifiedContextName());
TypeSystemImpl ts = cas.getTypeSystemImpl();
getCasManager().releaseCas(cas);
@@ -465,7 +465,7 @@ public abstract class AnalysisEngineImplBase extends ConfigurableResource_ImplBa
public void resetResultSpecificationToDefault() {
ResultSpecification resultSpec = new ResultSpecification_impl();
- resultSpec.addCapabilities(this.getAnalysisEngineMetaData().getCapabilities());
+ resultSpec.addCapabilities(getAnalysisEngineMetaData().getCapabilities());
setResultSpecification(resultSpec);
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineManagementImpl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineManagementImpl.java
index faa77b69e..642fdbaa2 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineManagementImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/AnalysisEngineManagementImpl.java
@@ -97,11 +97,11 @@ public class AnalysisEngineManagementImpl
@Override
public String getState() {
- return this.status.toString();
+ return status.toString();
}
public void setState(State state) {
- this.status = state;
+ status = state;
}
public void reportAnalysisTime(long time) {
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/MultiprocessingAnalysisEngine_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/MultiprocessingAnalysisEngine_impl.java
index cab96f508..52f2b5170 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/MultiprocessingAnalysisEngine_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/MultiprocessingAnalysisEngine_impl.java
@@ -118,7 +118,7 @@ public class MultiprocessingAnalysisEngine_impl extends AnalysisEngineImplBase
mPool = new AnalysisEnginePool("", poolSize, aSpecifier, aAdditionalParams);
// update metadata from pool (this gets the merged type system for aggregates)
- this.setMetaData(mPool.getMetaData());
+ setMetaData(mPool.getMetaData());
return true;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PearAnalysisEngineWrapper.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PearAnalysisEngineWrapper.java
index f10f68f5b..e6426a273 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PearAnalysisEngineWrapper.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PearAnalysisEngineWrapper.java
@@ -294,7 +294,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
: new HashMap<>(aAdditionalParams);
// clonedAdditionalParameters.remove(Resource.PARAM_UIMA_CONTEXT);
clonedAdditionalParameters.remove(Resource.PARAM_RESOURCE_MANAGER);
- this.ae = UIMAFramework.produceAnalysisEngine(specifier, innerRM, clonedAdditionalParameters);
+ ae = UIMAFramework.produceAnalysisEngine(specifier, innerRM, clonedAdditionalParameters);
} catch (IOException ex) {
throw new ResourceInitializationException(ex);
} catch (InvalidXMLException ex) {
@@ -306,7 +306,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
"initialize", LOG_RESOURCE_BUNDLE, "UIMA_analysis_engine_init_successful__CONFIG",
- new Object[] { this.ae.getAnalysisEngineMetaData().getName() });
+ new Object[] { ae.getAnalysisEngineMetaData().getName() });
return true;
}
@@ -326,7 +326,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public ResourceMetaData getMetaData() {
- return this.ae.getMetaData();
+ return ae.getMetaData();
}
/*
@@ -336,7 +336,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public void batchProcessComplete() throws AnalysisEngineProcessException {
- this.ae.batchProcessComplete();
+ ae.batchProcessComplete();
}
/*
@@ -346,7 +346,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public void collectionProcessComplete() throws AnalysisEngineProcessException {
- this.ae.collectionProcessComplete();
+ ae.collectionProcessComplete();
}
/*
@@ -364,15 +364,15 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINE, this.getClass().getName(),
"processAndOutputNewCASes", LOG_RESOURCE_BUNDLE,
"UIMA_analysis_engine_process_begin__FINE",
- new Object[] { this.ae.getAnalysisEngineMetaData().getName() });
+ new Object[] { ae.getAnalysisEngineMetaData().getName() });
}
- CasIterator result = this.ae.processAndOutputNewCASes(aCAS);
+ CasIterator result = ae.processAndOutputNewCASes(aCAS);
if (logger.isLoggable(Level.FINE)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.FINE, this.getClass().getName(),
"processAndOutputNewCASes", LOG_RESOURCE_BUNDLE,
"UIMA_analysis_engine_process_end__FINE",
- new Object[] { this.ae.getAnalysisEngineMetaData().getName() });
+ new Object[] { ae.getAnalysisEngineMetaData().getName() });
}
return result;
}
@@ -385,9 +385,9 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
"destroy", LOG_RESOURCE_BUNDLE, "UIMA_analysis_engine_destroyed__CONFIG",
- new Object[] { this.ae.getAnalysisEngineMetaData().getName() });
+ new Object[] { ae.getAnalysisEngineMetaData().getName() });
- this.ae.destroy();
+ ae.destroy();
}
/*
@@ -576,7 +576,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public void setResultSpecification(ResultSpecification resultSpec) {
- this.ae.setResultSpecification(resultSpec);
+ ae.setResultSpecification(resultSpec);
}
/*
@@ -589,7 +589,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
@Override
public void batchProcessComplete(ProcessTrace trace)
throws ResourceProcessException, IOException {
- this.ae.batchProcessComplete(trace);
+ ae.batchProcessComplete(trace);
}
/*
@@ -601,7 +601,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
@Override
public void collectionProcessComplete(ProcessTrace trace)
throws ResourceProcessException, IOException {
- this.ae.collectionProcessComplete(trace);
+ ae.collectionProcessComplete(trace);
}
/*
@@ -611,7 +611,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public ResultSpecification createResultSpecification() {
- return this.ae.createResultSpecification();
+ return ae.createResultSpecification();
}
/*
@@ -622,7 +622,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public ResultSpecification createResultSpecification(TypeSystem typeSystem) {
- return this.ae.createResultSpecification(typeSystem);
+ return ae.createResultSpecification(typeSystem);
}
/*
@@ -633,7 +633,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public ProcessingResourceMetaData getProcessingResourceMetaData() {
- return this.ae.getProcessingResourceMetaData();
+ return ae.getProcessingResourceMetaData();
}
/*
@@ -643,7 +643,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public synchronized CAS newCAS() throws ResourceInitializationException {
- return this.ae.newCAS();
+ return ae.newCAS();
}
/*
@@ -655,7 +655,7 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
*/
@Override
public void typeSystemInit(TypeSystem typeSystem) throws ResourceInitializationException {
- this.ae.typeSystemInit(typeSystem);
+ ae.typeSystemInit(typeSystem);
}
/**
@@ -677,8 +677,8 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((this.classPath == null) ? 0 : this.classPath.hashCode());
- result = prime * result + ((this.dataPath == null) ? 0 : this.dataPath.hashCode());
+ result = prime * result + ((classPath == null) ? 0 : classPath.hashCode());
+ result = prime * result + ((dataPath == null) ? 0 : dataPath.hashCode());
return result;
}
@@ -686,20 +686,18 @@ public class PearAnalysisEngineWrapper extends AnalysisEngineImplBase {
public boolean equals(Object obj) {
if (this == obj)
return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
+ if ((obj == null) || (getClass() != obj.getClass()))
return false;
final StringPair other = (StringPair) obj;
- if (this.classPath == null) {
+ if (classPath == null) {
if (other.classPath != null)
return false;
- } else if (!this.classPath.equals(other.classPath))
+ } else if (!classPath.equals(other.classPath))
return false;
- if (this.dataPath == null) {
+ if (dataPath == null) {
if (other.dataPath != null)
return false;
- } else if (!this.dataPath.equals(other.dataPath))
+ } else if (!dataPath.equals(other.dataPath))
return false;
return true;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
index 22fca8562..4e879b5fc 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/PrimitiveAnalysisEngine_impl.java
@@ -111,13 +111,9 @@ public class PrimitiveAnalysisEngine_impl extends AnalysisEngineImplBase impleme
// this includes CollectionReader, and CasConsumer descriptors
// as well as AnalysisEngine descriptors.
- if (!(aSpecifier instanceof ResourceCreationSpecifier)) {
- return false;
- }
-
// BUT, for AnalysisEngineDescriptions, must not be an aggregate
- if (aSpecifier instanceof AnalysisEngineDescription
- && !((AnalysisEngineDescription) aSpecifier).isPrimitive()) {
+ if (!(aSpecifier instanceof ResourceCreationSpecifier) || (aSpecifier instanceof AnalysisEngineDescription
+ && !((AnalysisEngineDescription) aSpecifier).isPrimitive())) {
return false;
}
@@ -368,7 +364,7 @@ public class PrimitiveAnalysisEngine_impl extends AnalysisEngineImplBase impleme
mCurrentResultSpecification.setTypeSystem(mLastTypeSystem);
rsFromOutputCapabilities = new ResultSpecification_impl(mLastTypeSystem);
rsFromOutputCapabilities
- .addCapabilities(this.getAnalysisEngineMetaData().getCapabilities());
+ .addCapabilities(getAnalysisEngineMetaData().getCapabilities());
}
// the actual ResultSpec we send to the component is formed by
// looking at this primitive AE's declared output types and eliminating
@@ -382,7 +378,7 @@ public class PrimitiveAnalysisEngine_impl extends AnalysisEngineImplBase impleme
// insure view is passed to switch / restore class loader
// https://issues.apache.org/jira/browse/UIMA-2211
((CASImpl) view)
- .switchClassLoaderLockCasCL(this.getResourceManager().getExtensionClassLoader());
+ .switchClassLoaderLockCasCL(getResourceManager().getExtensionClassLoader());
callProcessMethod(mAnalysisComponent, casToPass);
// // call the process method
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/ResultSpecification_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/ResultSpecification_impl.java
index 16b2e39cb..645a33ef5 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/ResultSpecification_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/ResultSpecification_impl.java
@@ -791,10 +791,7 @@ public final class ResultSpecification_impl extends MetaDataObject_impl
}
static boolean equalsOrBothNull(Object x, Object y) {
- if (null == x && null == y) {
- return true;
- }
- if (null != x && x.equals(y)) {
+ if ((null == x && null == y) || (null != x && x.equals(y))) {
return true;
}
return false;
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsFeat.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsFeat.java
index d8755ae77..3b9785b9f 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsFeat.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsFeat.java
@@ -26,12 +26,12 @@ public class RsFeat {
RsLangs languages = null;
RsFeat(String shortName, String[] languages) {
- this.shortFeatName = shortName;
+ shortFeatName = shortName;
this.languages = RsLangs.createOrNull(languages);
}
RsFeat(String shortName, RsLangs languages) {
- this.shortFeatName = shortName;
+ shortFeatName = shortName;
if (null != languages) {
languages.setShared();
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsLangs.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsLangs.java
index f41957726..c43e044f2 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsLangs.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsLangs.java
@@ -271,7 +271,7 @@ public class RsLangs {
return null;
}
- if (null == this.languages) { // means x-unspecified, so return the other
+ if (null == languages) { // means x-unspecified, so return the other
return other;
}
if (null == other.languages) { // means x-unspecified, so return the first
@@ -281,7 +281,7 @@ public class RsLangs {
RsLangs r = new RsLangs();
r.languages = new ArrayList<>(0); // creates an empty, not null arraylist
- for (String lang : this.languages) {
+ for (String lang : languages) {
if (subsumesCanonical(other, lang)) {
r = add(r, lang); // add langs in other that are subsumed by this
}
@@ -322,10 +322,7 @@ public class RsLangs {
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
RsLangs other = (RsLangs) obj;
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsTypesMap.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsTypesMap.java
index 164a580ca..ef9596d8b 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsTypesMap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/RsTypesMap.java
@@ -258,10 +258,7 @@ public class RsTypesMap implements Iterable<RsType> {
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
RsTypesMap other = (RsTypesMap) obj;
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/TypeOrFeature_impl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/TypeOrFeature_impl.java
index d2ac652bb..fe80c3f81 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/TypeOrFeature_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/TypeOrFeature_impl.java
@@ -186,7 +186,7 @@ public class TypeOrFeature_impl extends MetaDataObject_impl implements TypeOrFea
// cast object
TypeOrFeature_impl tof = (TypeOrFeature_impl) obj;
- return this.getName().compareTo(tof.getName());
+ return getName().compareTo(tof.getName());
}
/**
@@ -213,10 +213,7 @@ public class TypeOrFeature_impl extends MetaDataObject_impl implements TypeOrFea
if (this == obj) {
return true;
}
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if (!super.equals(obj) || (getClass() != obj.getClass())) {
return false;
}
TypeOrFeature_impl other = (TypeOrFeature_impl) obj;
diff --git a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/UimacppAnalysisEngineImpl.java b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/UimacppAnalysisEngineImpl.java
index 3199c462c..f42f02efd 100644
--- a/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/UimacppAnalysisEngineImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/analysis_engine/impl/UimacppAnalysisEngineImpl.java
@@ -101,13 +101,9 @@ public class UimacppAnalysisEngineImpl extends AnalysisEngineImplBase implements
throws ResourceInitializationException {
// AnalysisEngine can be build from any ResourceCreationSpecifier-
// CasConsumer descriptors as well as AnalysisEngine descriptors.
- if (!(aSpecifier instanceof ResourceCreationSpecifier)) {
- return false;
- }
-
// aSpecifier must be a AnalysisEngineDescription or a CasConsumerDescription
- if (!(aSpecifier instanceof AnalysisEngineDescription)
- && !(aSpecifier instanceof CasConsumerDescription)) {
+ if (!(aSpecifier instanceof ResourceCreationSpecifier) || (!(aSpecifier instanceof AnalysisEngineDescription)
+ && !(aSpecifier instanceof CasConsumerDescription))) {
return false;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java b/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
index 536b91b84..4096a95d1 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
@@ -627,7 +627,7 @@ public interface CAS extends AbstractCas {
* @return the JCasImpl view for this CAS view
*/
default JCasImpl getJCasImpl() {
- return ((CASImpl) this.getLowLevelCAS()).getJCasImpl();
+ return ((CASImpl) getLowLevelCAS()).getJCasImpl();
}
/**
@@ -1263,7 +1263,7 @@ public interface CAS extends AbstractCas {
* @return a lazily created shared (for this CAS) empty list
*/
default <T extends TOP> EmptyList emptyList(Class<T> clazz) {
- return ((CASImpl) this.getLowLevelCAS())
+ return ((CASImpl) getLowLevelCAS())
.emptyListFromTypeCode(((TypeImpl) getCasType(clazz)).getCode());
}
@@ -1393,7 +1393,7 @@ public interface CAS extends AbstractCas {
* @return the corresponding Type, for this CAS
*/
default <T extends TOP> Type getCasType(Class<T> clazz) {
- return this.getJCasImpl().getCasType(clazz);
+ return getJCasImpl().getCasType(clazz);
}
/**
@@ -1427,7 +1427,7 @@ public interface CAS extends AbstractCas {
* corresponding to the JCas clazz, in no particular order.
*/
default <T extends TOP> FSIterator<T> getAllIndexedFS(Type type) {
- return this.getIndexRepository().getAllIndexedFS(type);
+ return getIndexRepository().getAllIndexedFS(type);
}
/**
@@ -1442,7 +1442,7 @@ public interface CAS extends AbstractCas {
* of the specified type (including subtypes)
*/
default <T extends TOP> Collection<T> getIndexedFSs(Type type) {
- return this.getIndexRepository().getIndexedFSs(type);
+ return getIndexRepository().getIndexedFSs(type);
}
/**
@@ -1453,7 +1453,7 @@ public interface CAS extends AbstractCas {
* of the specified type (including subtypes)
*/
default Collection<TOP> getIndexedFSs() {
- return this.getIndexRepository().getIndexedFSs();
+ return getIndexRepository().getIndexedFSs();
}
/**
@@ -1468,6 +1468,6 @@ public interface CAS extends AbstractCas {
* of the specified type (including subtypes)
*/
default <T extends TOP> Collection<T> getIndexedFSs(Class<T> clazz) {
- return this.getIndexRepository().getIndexedFSs(clazz);
+ return getIndexRepository().getIndexedFSs(clazz);
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AllFSs.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AllFSs.java
index e3d5b4e10..799bca96b 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AllFSs.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AllFSs.java
@@ -82,10 +82,10 @@ class AllFSs {
*/
AllFSs(CASImpl cas) {
this.cas = cas;
- this.mark = null;
+ mark = null;
foundFSsBelowMark = null;
- this.includeFilter = null;
- this.typeMapper = null;
+ includeFilter = null;
+ typeMapper = null;
}
private AllFSs getAllFSsAllViews_sofas() {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationImplException.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationImplException.java
index f5c6bbcf0..292034db6 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationImplException.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationImplException.java
@@ -96,7 +96,7 @@ public class AnnotationImplException extends Exception {
* file. Unfortunately, the error parameters get lost that way.
*/
public int getError() {
- return this.error;
+ return error;
}
/**
@@ -104,18 +104,18 @@ public class AnnotationImplException extends Exception {
*/
@Override
public String getMessage() {
- if (this.resource == null) {
+ if (resource == null) {
try {
- this.resource = ResourceBundle.getBundle(resource_file);
+ resource = ResourceBundle.getBundle(resource_file);
} catch (MissingResourceException e) {
- this.error = MESSAGES_NOT_FOUND;
+ error = MESSAGES_NOT_FOUND;
return missing_resource_error;
}
}
// Retrieve message from resource bundle, format using arguments,
// and return resulting string.
- return (new MessageFormat(this.resource.getString(identifiers[this.error])))
- .format(this.arguments);
+ return (new MessageFormat(resource.getString(identifiers[error])))
+ .format(arguments);
}
/**
@@ -123,7 +123,7 @@ public class AnnotationImplException extends Exception {
*/
@Override
public String toString() {
- return this.getClass().getSimpleName() + ": " + this.getMessage();
+ return this.getClass().getSimpleName() + ": " + getMessage();
}
/**
@@ -140,9 +140,9 @@ public class AnnotationImplException extends Exception {
*/
public boolean addArgument(String s) {
int i = 0;
- while (i < this.arguments.length) {
- if (this.arguments[i] == null) {
- this.arguments[i] = s;
+ while (i < arguments.length) {
+ if (arguments[i] == null) {
+ arguments[i] = s;
return true;
}
i++;
@@ -156,7 +156,7 @@ public class AnnotationImplException extends Exception {
* @return The internal message key.
*/
public String getMessageCode() {
- return identifiers[this.error];
+ return identifiers[error];
}
/**
@@ -165,7 +165,7 @@ public class AnnotationImplException extends Exception {
* @return The arguments to the exception.
*/
public String[] getArguments() {
- return this.arguments;
+ return arguments;
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeImpl.java
index ae57c71eb..3a15670e8 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeImpl.java
@@ -35,7 +35,7 @@ public class AnnotationTreeImpl<T extends AnnotationFS> implements AnnotationTre
@Override
public AnnotationTreeNode<T> getRoot() {
- return this.root;
+ return root;
}
void setRoot(AnnotationTreeNodeImpl<T> root) {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java
index 3202d98af..1cdf376e9 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java
@@ -36,23 +36,23 @@ public class AnnotationTreeNodeImpl<T extends AnnotationFS> implements Annotatio
private int pos;
AnnotationTreeNodeImpl() {
- this.dtrs = new ArrayList<>();
+ dtrs = new ArrayList<>();
}
@Override
public AnnotationTreeNode<T> getParent() {
- return this.parent;
+ return parent;
}
@Override
public int getChildCount() {
- return this.dtrs.size();
+ return dtrs.size();
}
@Override
public AnnotationTreeNode<T> getChild(int i) throws CASRuntimeException {
try {
- return this.dtrs.get(i);
+ return dtrs.get(i);
} catch (IndexOutOfBoundsException e) {
throw new CASRuntimeException(CASRuntimeException.CHILD_INDEX_OOB, null);
}
@@ -60,11 +60,11 @@ public class AnnotationTreeNodeImpl<T extends AnnotationFS> implements Annotatio
@Override
public AnnotationTreeNode<T> getNextSibling() {
- if (this.parent == null) {
+ if (parent == null) {
return null;
}
try {
- return this.parent.getChild(this.pos + 1);
+ return parent.getChild(pos + 1);
} catch (CASRuntimeException e) {
return null;
}
@@ -72,11 +72,11 @@ public class AnnotationTreeNodeImpl<T extends AnnotationFS> implements Annotatio
@Override
public AnnotationTreeNode<T> getPreviousSibling() {
- if (this.parent == null) {
+ if (parent == null) {
return null;
}
try {
- return this.parent.getChild(this.pos - 1);
+ return parent.getChild(pos - 1);
} catch (CASRuntimeException e) {
return null;
}
@@ -89,7 +89,7 @@ public class AnnotationTreeNodeImpl<T extends AnnotationFS> implements Annotatio
*/
@Override
public ArrayList<AnnotationTreeNode<T>> getChildren() {
- return this.dtrs;
+ return dtrs;
}
/*
@@ -99,7 +99,7 @@ public class AnnotationTreeNodeImpl<T extends AnnotationFS> implements Annotatio
*/
@Override
public T get() {
- return this.annot;
+ return annot;
}
// ////////////////////////////////////////////////////////////////////////////
@@ -110,9 +110,9 @@ public class AnnotationTreeNodeImpl<T extends AnnotationFS> implements Annotatio
}
void addChild(AnnotationTreeNodeImpl<T> child) {
- child.pos = this.dtrs.size();
+ child.pos = dtrs.size();
child.parent = this;
- this.dtrs.add(child);
+ dtrs.add(child);
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java
index a1580c736..1a14ac191 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes.java
@@ -22,7 +22,6 @@ package org.apache.uima.cas.impl;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -45,6 +44,7 @@ import org.apache.uima.internal.util.IntListIterator;
import org.apache.uima.internal.util.IntVector;
import org.apache.uima.internal.util.Misc;
import org.apache.uima.internal.util.Obj2IntIdentityHashMap;
+import org.apache.uima.internal.util.SerializationUtils;
import org.apache.uima.internal.util.function.Consumer_T_int_withIOException;
import org.apache.uima.jcas.cas.BooleanArray;
import org.apache.uima.jcas.cas.ByteArray;
@@ -209,7 +209,7 @@ public class BinaryCasSerDes {
boolean isBeforeV3 = false;
public BinaryCasSerDes(CASImpl baseCAS) {
- this.baseCas = baseCAS;
+ baseCas = baseCAS;
}
// *********************************
@@ -251,11 +251,12 @@ public class BinaryCasSerDes {
*/
void reinit(int[] heapMetadata, int[] heapArray, String[] stringTable, int[] fsIndex,
byte[] byteHeapArray, short[] shortHeapArray, long[] longHeapArray) {
- CommonSerDesSequential csds = new CommonSerDesSequential(baseCas); // for non Delta case, not
- // held on to
- // compare with compress form 4, which does cas.getCsds() or cas.newCsds() which saves it in
- // cas.svd
+
+ // for non Delta case, not held on to compare with compress form 4, which does cas.getCsds() or
+ // cas.newCsds() which saves it in cas.svd
+ CommonSerDesSequential csds = new CommonSerDesSequential(baseCas);
csds.setup(null, 1);
+
heap = new Heap();
byteHeap = new ByteHeap();
shortHeap = new ShortHeap();
@@ -283,7 +284,6 @@ public class BinaryCasSerDes {
public CASImpl setupCasFromCasMgrSerializer(CASMgrSerializer casMgrSerializer) {
if (null != casMgrSerializer) {
-
TypeSystemImpl ts = casMgrSerializer.getTypeSystem();
baseCas.svd.clear(); // does all clearing except index repositories which will be wiped out
baseCas.installTypeSystemInAllViews(ts);
@@ -307,6 +307,7 @@ public class BinaryCasSerDes {
baseCas.svd.setViewForSofaNbr(1, initialView);
baseCas.svd.viewCount = 1;
}
+
return baseCas;
}
@@ -378,9 +379,6 @@ public class BinaryCasSerDes {
/**
* if not an array (array values can't be keys) remove if the feature being updated is in an
* index key
- *
- * @param heapAddr
- * -
*/
private void maybeRemove(int heapAddr) {
TypeImpl type = fs._getTypeImpl();
@@ -397,8 +395,6 @@ public class BinaryCasSerDes {
* for Deserialization of Delta, when updating existing FSs, If the heap addr is for the next
* FS, re-add the previous one to those indexes where it was removed, and then maybe remove the
* new one (and remember which views to re-add to).
- *
- * @param heapAddr
*/
private void maybeAddBackAndRemoveFs(int heapAddr, Int2ObjHashMap<TOP, TOP> addr2fs) {
if (fsStartAddr == -1) {
@@ -421,11 +417,6 @@ public class BinaryCasSerDes {
* things in the bds. Special cases: if the addr is in the middle of an already setup FS, just
* return The search is done using a binary search, with an exception to check the next item
* (optimization)
- *
- * @param heapAddr
- * - the heap addr
- * @param bds
- * -
*/
private void findCorrespondingFs(int heapAddr, Int2ObjHashMap<TOP, TOP> addr2fs) {
if (fsStartAddr < heapAddr && heapAddr < fsEndAddr) {
@@ -617,9 +608,8 @@ public class BinaryCasSerDes {
static CASMgrSerializer maybeReadEmbeddedTSI(Header h, DataInputStream dis) {
if (h.isTypeSystemIncluded() || h.isTypeSystemIndexDefIncluded()) { // Load TS from CAS stream
try {
- ObjectInputStream ois = new ObjectInputStream(dis);
- return (CASMgrSerializer) ois.readObject();
- } catch (ClassNotFoundException | IOException e) {
+ return SerializationUtils.deserializeCASMgrSerializer(dis);
+ } catch (IOException e) {
/** Unrecognized serialized CAS format */
throw new CASRuntimeException(CASRuntimeException.UNRECOGNIZED_SERIALIZED_CAS_FORMAT, null,
e);
@@ -1027,9 +1017,6 @@ public class BinaryCasSerDes {
/**
* Called 3 times to process non-compressed binary deserialization of aux array modifications -
* once for byte/boolean, short, and long/double
- *
- * @return heapsz (used by caller to do word alignment)
- * @throws IOException
*/
int updateAuxArrayMods(Reading r, Int2ObjHashMap<TOP, TOP> auxAddr2fsa,
Consumer_T_int_withIOException<TOP> setter) throws IOException {
@@ -1223,9 +1210,9 @@ public class BinaryCasSerDes {
*
* @param ir
* index repository
- * @param fss
+ * @param fsindexes
* the list having the fss
- * @param fsIdx
+ * @param idx
* the starting index
* @param length
* the length
@@ -1449,7 +1436,6 @@ public class BinaryCasSerDes {
*
* The results must be retained for the use case of subsequently receiving back a delta cas.
*
- * @param cs the CASSerializer instance used to record the results of the scan
* @param mark null or the mark to use for separating the new from from the previously existing
* used by delta cas.
* @return null or for delta, all the found FSs
@@ -1517,7 +1503,7 @@ public class BinaryCasSerDes {
if (type.isArray()) {
// next slot is the length
- final int length = ((CommonArrayFS) fs).size();
+ final int length = ((CommonArrayFS<?>) fs).size();
heap.heap[pos + arrayLengthFeatOffset] = length;
// next slot are the values
int i = pos + arrayContentOffset;
@@ -1584,7 +1570,7 @@ public class BinaryCasSerDes {
break;
}
case Slot_HeapRef:
- for (TOP fsitem : ((FSArray) fs)._getTheArray()) {
+ for (TOP fsitem : ((FSArray<?>) fs)._getTheArray()) {
heap.heap[i++] = fs2addr.get(fsitem);
}
break;
@@ -1680,7 +1666,7 @@ public class BinaryCasSerDes {
List<Runnable> fixups4UimaSerialization = new ArrayList<>();
for (int heapIndex = startPos; heapIndex < heapsz; heapIndex += getFsSpaceReq(fs, type)) {
- int typecode = heap.heap[heapIndex];
+ // int typecode = heap.heap[heapIndex];
// if (isBeforeV3 && typecode > TypeSystemConstants.lastBuiltinV2TypeCode) {
// typecode = typecode + TypeSystemConstants.numberOfNewBuiltInsSinceV2;
// }
@@ -1750,7 +1736,7 @@ public class BinaryCasSerDes {
}
case Slot_HeapRef: {
- TOP[] fsa = ((FSArray) fs)._getTheArray();
+ TOP[] fsa = ((FSArray<?>) fs)._getTheArray();
for (int ai = 0; ai < len; ai++) {
int a = heap.heap[hhi + ai];
if (a == 0) {
@@ -1978,14 +1964,12 @@ public class BinaryCasSerDes {
case Slot_Float:
((FloatArray) fs).set(hsai, CASImpl.int2float(slotValue));
break;
-
case Slot_StrRef:
((StringArray) fs).set(hsai, stringHeap.getStringForCode(slotValue));
break;
case Slot_HeapRef:
((FSArray) fs).set(hsai, addr2fs.get(slotValue));
break;
-
default:
Misc.internalError();
} // end of switch for component type of arrays
@@ -2028,11 +2012,6 @@ public class BinaryCasSerDes {
}
/**
- *
- * @param fs
- * @param feat
- * @param s
- * @param fixups4forwardFsRefs
* @return true if caller needs to do an appropriate fs._setStringValue...
*/
private boolean updateStringFeature(TOP fs, FeatureImpl feat, String s,
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java
index bd5faf4a7..1d65147e0 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes4.java
@@ -236,7 +236,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
public BinaryCasSerDes4(TypeSystemImpl ts, boolean doMeasurements) {
this.ts = ts;
this.doMeasurements = doMeasurements;
- this.fsArrayType = ts.fsArrayType;
+ fsArrayType = ts.fsArrayType;
}
/**
@@ -416,9 +416,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
private Serializer(CASImpl cas, DataOutputStream serializedOut, MarkerImpl mark,
SerializationMeasures sm, CompressLevel compressLevel, CompressStrat compressStrategy,
boolean isTsi) {
- this.baseCas = cas.getBaseCAS();
- this.bcsd = cas.getBinaryCasSerDes();
- this.isDelta = (mark != null);
+ baseCas = cas.getBaseCAS();
+ bcsd = cas.getBinaryCasSerDes();
+ isDelta = (mark != null);
// this.csds = getCsds(baseCas, isDelta);
// this.ccs = new CommonCompressedSerialization(
// new CommonSerDesTypeMap(cas.getTypeSystemImpl(), cas.getTypeSystemImpl()), // no type
@@ -466,7 +466,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
strSeg_dos = dosZipSources[strSeg_i];
uimaSerializableSavedToCas = new PositiveIntSet_impl(1024, 1, 1024);
- this.prevFsByType = new TOP[ts.getTypeArraySize()];
+ prevFsByType = new TOP[ts.getTypeArraySize()];
csds = getCsds(baseCas, isDelta);
// getCsds() internally already causes _save_to_cas_data() to be called (via AllFSs), so we
// have to add all the FSes that are returned here to the uimaSerializableSavedToCas tracking
@@ -485,8 +485,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
* the source id's if some FSs were GC'd.
*
* To determine for delta what new strings and new
- *
- * @throws IOException
*/
private void serialize() throws IOException {
@@ -510,8 +508,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
CasIOUtils.writeTypeSystem(baseCas, serializedOut, true);
}
- if (TRACE_SER)
+ if (TRACE_SER) {
System.out.println("Form4Ser start, delta: " + (isDelta ? "true" : "false"));
+ }
/*******************************************************************************
* Setup tables that map to v2 "addresses" - needed for backwards compatibility fs2addr -
* feature structure to address addr2fs - address to feature structure sortedFSs - sorted by
@@ -600,13 +599,15 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
// heapEnd);
// }
- if (TRACE_SER)
+ if (TRACE_SER) {
System.out.println("Form4Ser heapstart: " + heapStart + " heapEnd: " + heapEnd);
+ }
writeVnumber(control_dos, heapEnd - heapStart); // used for delta heap size to grow the CAS
// and ending condition on deser loop
- if (TRACE_SER)
+ if (TRACE_SER) {
System.out.println("Form4Ser heapstart: " + heapStart + " heapEnd: " + heapEnd);
+ }
Arrays.fill(prevFsByType, null);
// if (heapStart == 0) {
@@ -624,13 +625,15 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
writeFs(fs);
}
- if (TRACE_SER)
+ if (TRACE_SER) {
System.out.println("Form4Ser writing index info");
+ }
serializeIndexedFeatureStructures(csds);
if (isDelta) {
- if (TRACE_SER)
+ if (TRACE_SER) {
System.out.println("Form4Ser writing modified FSs");
+ }
(new SerializeModifiedFSs(csds)).serializeModifiedFSs();
}
@@ -644,8 +647,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
/**
* Write the compressed string table(s)
- *
- * @throws IOException
*/
private void writeStringInfo() throws IOException {
String[] commonStrings = os.getCommonStrings();
@@ -718,11 +719,11 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
// }
}
- private void serializeIndexedFeatureStructures(final CommonSerDesSequential csds)
+ private void serializeIndexedFeatureStructures(final CommonSerDesSequential aCsds)
throws IOException {
// fsIndexes already have the modelled address conversion
- int[] fsIndexes = isDelta ? bcsd.getDeltaIndexedFSs(mark, csds.fs2addr)
- : bcsd.getIndexedFSs(csds.fs2addr);
+ int[] fsIndexes = isDelta ? bcsd.getDeltaIndexedFSs(mark, aCsds.fs2addr)
+ : bcsd.getIndexedFSs(aCsds.fs2addr);
if (doMeasurement) {
sm.statDetails[fsIndexes_i].original = fsIndexes.length * 4 + 1;
}
@@ -747,15 +748,15 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
}
for (int vi = 0; vi < nbrViews; vi++) {
- fi = compressFsxPart(fsIndexes, fi, csds); // added FSs
+ fi = compressFsxPart(fsIndexes, fi, aCsds); // added FSs
if (isDelta) {
- fi = compressFsxPart(fsIndexes, fi, csds); // removed FSs
- fi = compressFsxPart(fsIndexes, fi, csds); // reindexed FSs
+ fi = compressFsxPart(fsIndexes, fi, aCsds); // removed FSs
+ fi = compressFsxPart(fsIndexes, fi, aCsds); // reindexed FSs
}
}
}
- private int compressFsxPart(int[] fsIndexes, int fsNdxStart, final CommonSerDesSequential csds)
+ private int compressFsxPart(int[] fsIndexes, int fsNdxStart, final CommonSerDesSequential aCsds)
throws IOException {
int ix = fsNdxStart;
final int nbrEntries = fsIndexes[ix++];
@@ -767,7 +768,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
final int[] ia = new int[nbrEntries];
for (int i = ix, t = 0; i < end; i++, t++) {
- ia[t] = fs2seq(csds.addr2fs.get(fsIndexes[i])); // convert "addr" to "seq" offset
+ ia[t] = fs2seq(aCsds.addr2fs.get(fsIndexes[i])); // convert "addr" to "seq" offset
}
// System.arraycopy(fsIndexes, ix, ia, 0, nbrEntries);
Arrays.sort(ia);
@@ -798,7 +799,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
switch (arrayElementKind) {
case Slot_HeapRef: {
int prev = getPrevArray0HeapRef();
- for (TOP item : ((FSArray) fs)._getTheArray()) {
+ for (TOP item : ((FSArray<?>) fs)._getTheArray()) {
int v = fs2seq(item);
writeDiff(arrayElementKind.ordinal(), v, prev);
prev = v;
@@ -865,18 +866,20 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
}
private int getPrevArray0HeapRef() {
- if (isNoPrevArrayValue((CommonArrayFS) prevFs))
+ if (isNoPrevArrayValue((CommonArrayFS<?>) prevFs)) {
return 0;
- return fs2seq((TOP) ((FSArray) prevFs).get(0));
+ }
+ return fs2seq((TOP) ((FSArray<?>) prevFs).get(0));
}
private int getPrevArray0Int() {
- if (isNoPrevArrayValue((CommonArrayFS) prevFs))
+ if (isNoPrevArrayValue((CommonArrayFS<?>) prevFs)) {
return 0;
+ }
return ((IntegerArray) prevFs).get(0);
}
- private boolean isNoPrevArrayValue(CommonArrayFS prevCommonArray) {
+ private boolean isNoPrevArrayValue(CommonArrayFS<?> prevCommonArray) {
return prevCommonArray == null || prevCommonArray.size() == 0;
}
@@ -932,7 +935,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
}
private int serializeArrayLength(TOP fs) throws IOException {
- int length = ((CommonArrayFS) fs).size();
+ int length = ((CommonArrayFS<?>) fs).size();
writeVnumber(arrayLength_i, length);
return length;
}
@@ -980,9 +983,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
long startTime = System.currentTimeMillis();
int zipBufSize = Math.max(1024, baos.size() / 100);
deflater.reset();
- DeflaterOutputStream cds = new DeflaterOutputStream(baosZipped, deflater, zipBufSize);
- baos.writeTo(cds);
- cds.close();
+ try (var cds = new DeflaterOutputStream(baosZipped, deflater, zipBufSize)) {
+ baos.writeTo(cds);
+ }
idxAndLen.add(i);
if (doMeasurement) {
idxAndLen.add((int) (sm.statDetails[i].afterZip = deflater.getBytesWritten()));
@@ -1264,8 +1267,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
/**
* For delta, for each fsChange element, extract any strings
- *
- * @param fsChange
*/
private void extractStringsFromModifications(FsChange fsChange) {
final TOP fs = fsChange.fs;
@@ -1466,7 +1467,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
break;
case Slot_HeapRef:
- int v = fs2seq((TOP) ((FSArray) fs).get(i));
+ int v = fs2seq((TOP) ((FSArray<?>) fs).get(i));
writeDiff(kindi, v, vPrevModHeapRef);
vPrevModHeapRef = v;
break;
@@ -1667,10 +1668,10 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
* passthru
*/
Deserializer(CASImpl cas, DataInput deserIn, boolean isDelta) throws IOException {
- this.baseCas = cas.getBaseCAS();
- this.ivCas = baseCas.getInitialView();
- this.bcsd = cas.getBinaryCasSerDes();
- this.csds = getCsds(baseCas, isDelta);
+ baseCas = cas.getBaseCAS();
+ ivCas = baseCas.getInitialView();
+ bcsd = cas.getBinaryCasSerDes();
+ csds = getCsds(baseCas, isDelta);
this.deserIn = deserIn;
this.isDelta = isDelta;
@@ -1710,8 +1711,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
}
private void deserialize(CommonSerDes.Header h) throws IOException {
- if (TRACE_DES)
+ if (TRACE_DES) {
System.out.println("Form4Deser starting");
+ }
// fs2seq.clear();
seq2fs.clear();
@@ -1759,8 +1761,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
// heap = heapObj.heap;
for (int[] ia : prevFsRefsByType) {
- if (ia != null)
+ if (ia != null) {
Arrays.fill(ia, 0);
+ }
}
if (heapStart == 0) {
@@ -1785,8 +1788,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
int arraySize = 0;
Arrays.fill(prevFsByType, null);
- if (TRACE_DES)
+ if (TRACE_DES) {
System.out.println("Form4Deser heapStart: " + heapStart + " heapEnd: " + heapEnd);
+ }
for (int iHeap = heapStart; iHeap < heapEnd; iHeap += type.getFsSpaceReq(arraySize)) {
final int typeCode = readVnumber(typeCode_dis);
// final int adjTypeCode = typeCode + ((this.bcsd.isBeforeV3 && typeCode >
@@ -1801,7 +1805,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
if (type.isArray()) {
currentFs = readArray(iHeap, type);
- arraySize = ((CommonArrayFS) currentFs).size();
+ arraySize = ((CommonArrayFS<?>) currentFs).size();
} else {
if (!ts.annotBaseType.subsumes(type) && // defer subtypes of AnnotationBase
!(ts.sofaType == type)) { // defer sofa types
@@ -1894,13 +1898,15 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
r.run();
}
- if (TRACE_DES)
+ if (TRACE_DES) {
System.out.println("Form4Deser indexing FSs");
+ }
readIndexedFeatureStructures();
if (isDelta) {
- if (TRACE_DES)
+ if (TRACE_DES) {
System.out.println("Form4Deser modifying existing FSs");
+ }
(new ReadModifiedFSs()).readModifiedFSs();
}
@@ -1975,7 +1981,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
break;
case Slot_HeapRef: {
- final TOP[] a = ((FSArray) fs)._getTheArray();
+ final TOP[] a = ((FSArray<?>) fs)._getTheArray();
int prev = getPrevIntValue(refKind, null);
for (int i = 0; i < a.length; i++) {
final int v = readDiff(SlotKind.Slot_HeapRef, prev);
@@ -2007,15 +2013,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
return readVnumber(arrayLength_dis);
}
- /**
- * If the fs is null, accumulate fixup operations, otherwise directly set this
- *
- * @param fs
- * - null or the fs whose slots are to be set
- * @param feat
- * @param type
- * @throws IOException
- */
private void readByKind(FeatureImpl feat, TypeImpl type) throws IOException {
SlotKind kind = feat.getSlotKind();
@@ -2062,7 +2059,7 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
// but binary serialization keeps creation order
}
if (ts.annotBaseSofaFeat != feat || sofaRef == null) {
- https: // issues.apache.org/jira/browse/UIMA-5588
+ // https://issues.apache.org/jira/browse/UIMA-5588
maybeStoreOrDefer(lfs -> {
// in addition to deferring if currentFs is null,
// heap refs may need deferring if forward refs
@@ -2079,8 +2076,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
case Slot_StrRef: {
String s = readString();
- if (null == s)
+ if (null == s) {
break; // null is default, no need to store it
+ }
if (ts.sofaType.subsumes(type)) {
if (feat == ts.sofaId) {
sofaName = s;
@@ -2143,10 +2141,8 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
}
}
- bcsd.reinitIndexedFSs(fsIndexes.getArray(), isDelta, i -> seq2fs.get(i), // written on
- // separate line for
- // Eclipse breakpoint
- // control
+ bcsd.reinitIndexedFSs(fsIndexes.getArray(), isDelta, i -> seq2fs.get(i),
+ // written on separate line for Eclipse breakpoint control
i -> csds.addr2fs.get(i) // https://issues.apache.org/jira/browse/UIMA-5593
);
}
@@ -2154,10 +2150,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
/**
* Maybe defers setting features for a Feature Structure if the FS isn't created yet (perhaps
* because it needs a sofa ref, not yet read)
- *
- * @param fs
- * - the Feature Structure or null if not yet created
- * @param storeAction
*/
private void maybeStoreOrDefer(Consumer<TOP> storeAction) {
if (null == currentFs) {
@@ -2167,9 +2159,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
}
}
- /**
- * FS Ref slots fixups
- */
/**
* FS Ref slots fixups
*
@@ -2311,7 +2300,6 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
* @param kind - the slot kind being deserialized
* @param feat - the feature (null for arrays)
* @return - the previous value, for differencing
- * @throws IOException
*/
// @formatter:on
private int readDiffWithPrevTypeSlot(SlotKind kind, FeatureImpl feat) throws IOException {
@@ -2334,10 +2322,8 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
/**
* Common code for feature offset and array
*
- * @param kind
* @param feat
* feature or null for array access
- * @return
*/
private int getPrevIntValue(SlotKind kind, FeatureImpl feat) {
if (kind == SlotKind.Slot_HeapRef) {
@@ -2683,8 +2669,9 @@ public class BinaryCasSerDes4 implements SlotKindsConstants {
return cache;
}
- if (type.isArray())
+ if (type.isArray()) {
return null; // all arrays except fsArray (see above) don't have fs refs
+ }
int[] cache = prevFsRefsByType[type.getCode()];
if (null == cache && type.hasRefFeature) { // skip allocating if no refs
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
index e6bcec21c..abc95f4dc 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
@@ -559,7 +559,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
cas = ((CASImpl) ((aCas instanceof JCas) ? ((JCas) aCas).getCas() : aCas)).getBaseCAS();
bcsd = cas.getBinaryCasSerDes();
- this.srcTs = cas.getTypeSystemImpl();
+ srcTs = cas.getTypeSystemImpl();
this.mark = mark;
if (null != mark && !mark.isValid()) {
@@ -567,7 +567,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
}
this.doMeasurements = doMeasurements;
- this.sm = doMeasurements ? new SerializationMeasures() : null;
+ sm = doMeasurements ? new SerializationMeasures() : null;
isDelta = isSerializingDelta = (mark != null);
typeMapper = srcTs.getTypeSystemMapper(tgtTs);
@@ -618,37 +618,37 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
*/
BinaryCasSerDes6(BinaryCasSerDes6 f6, TypeSystemImpl tgtTs)
throws ResourceInitializationException {
- this.cas = f6.cas;
- this.bcsd = f6.bcsd;
- this.stringHeapObj = f6.stringHeapObj;
- this.nextFsId = f6.nextFsId;
+ cas = f6.cas;
+ bcsd = f6.bcsd;
+ stringHeapObj = f6.stringHeapObj;
+ nextFsId = f6.nextFsId;
- this.srcTs = f6.srcTs;
+ srcTs = f6.srcTs;
this.tgtTs = tgtTs; // passed in argument !
- this.compressLevel = f6.compressLevel;
- this.compressStrategy = f6.compressStrategy;
+ compressLevel = f6.compressLevel;
+ compressStrategy = f6.compressStrategy;
- this.mark = f6.mark;
+ mark = f6.mark;
if (null != mark && !mark.isValid()) {
throw new CASRuntimeException(CASRuntimeException.INVALID_MARKER, "Invalid Marker.");
}
- this.isDelta = this.isSerializingDelta = (mark != null);
- this.fsStartIndexes = f6.fsStartIndexes;
- this.reuseInfoProvided = f6.reuseInfoProvided;
- this.doMeasurements = f6.doMeasurements;
- this.sm = f6.sm;
+ isDelta = isSerializingDelta = (mark != null);
+ fsStartIndexes = f6.fsStartIndexes;
+ reuseInfoProvided = f6.reuseInfoProvided;
+ doMeasurements = f6.doMeasurements;
+ sm = f6.sm;
- this.isTsIncluded = f6.isTsIncluded;
- this.isTsiIncluded = f6.isTsiIncluded;
+ isTsIncluded = f6.isTsIncluded;
+ isTsiIncluded = f6.isTsiIncluded;
- this.typeMapper = srcTs.getTypeSystemMapper(tgtTs);
- this.isTypeMapping = (null != typeMapper);
- this.prevHeapInstanceWithIntValues = f6.prevHeapInstanceWithIntValues;
- this.prevFsWithLongValues = f6.prevFsWithLongValues;
- this.foundFSs = f6.foundFSs;
- this.foundFSsBelowMark = f6.foundFSsBelowMark;
- this.fssToSerialize = f6.fssToSerialize;
+ typeMapper = srcTs.getTypeSystemMapper(tgtTs);
+ isTypeMapping = (null != typeMapper);
+ prevHeapInstanceWithIntValues = f6.prevHeapInstanceWithIntValues;
+ prevFsWithLongValues = f6.prevFsWithLongValues;
+ foundFSs = f6.foundFSs;
+ foundFSsBelowMark = f6.foundFSsBelowMark;
+ fssToSerialize = f6.fssToSerialize;
}
@@ -937,7 +937,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
private void serializeArray(TOP fs) throws IOException {
final TypeImpl_array arrayType = (TypeImpl_array) fs._getTypeImpl();
- CommonArrayFS a = (CommonArrayFS) fs;
+ CommonArrayFS<?> a = (CommonArrayFS<?>) fs;
final SlotKind arrayElementKind = arrayType.getComponentSlotKind();
final int length = serializeArrayLength(a);
@@ -965,7 +965,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
// prev = getTgtSeqFromSrcFS(prevFsArray.get(0));
// } // else use the preset 0 value
- for (TOP element : ((FSArray) fs)._getTheArray()) {
+ for (TOP element : ((FSArray<?>) fs)._getTheArray()) {
final int v = getTgtSeqFromSrcFS(element);
writeDiff(io, v, prev);
if (isUpdatePrevOK && isFirstElement) {
@@ -1049,7 +1049,6 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
* Caller iterates over target slots, but the feat arg is for the corresponding src feature
* @param fs the FS whose slot "feat" is to be serialize
* @param feat the corresponding source feature slot to serialize
- * @throws IOException
*/
// @formatter:on
private void serializeByKind(TOP fs, FeatureImpl feat) throws IOException {
@@ -1096,7 +1095,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
} // end of switch
}
- private int serializeArrayLength(CommonArrayFS array) throws IOException {
+ private int serializeArrayLength(CommonArrayFS<?> array) throws IOException {
final int length = array.size();
writeVnumber(arrayLength_i, length);
return length;
@@ -1114,8 +1113,8 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
/**
* Called for non-arrays
*
- * @param fs
- * used to get the type
+ * @param ti
+ * the type
* @param featOffset
* offset to the slot
* @param newValue
@@ -1133,9 +1132,6 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
/**
* version called for arrays, captures the 0th value
- *
- * @param ti
- * @param newValue
*/
private void updatePrevArray0IntValue(TypeImpl ti, int newValue) {
final int[] featCache = initPrevIntValue(ti);
@@ -1237,9 +1233,9 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
long startTime = System.currentTimeMillis();
int zipBufSize = Math.max(1024, baos.size() / 100);
deflater.reset();
- DeflaterOutputStream cds = new DeflaterOutputStream(baosZipped, deflater, zipBufSize);
- baos.writeTo(cds);
- cds.close();
+ try (var cds = new DeflaterOutputStream(baosZipped, deflater, zipBufSize)) {
+ baos.writeTo(cds);
+ }
idxAndLen.add(i);
if (doMeasurements) {
idxAndLen.add((int) (sm.statDetails[i].afterZip = deflater.getBytesWritten()));
@@ -1590,13 +1586,9 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
for (FsChange changedFs : modifiedFSs) {
final TOP fs = changedFs.fs;
final TypeImpl srcType = fs._getTypeImpl();
- if (isTypeMapping && null == typeMapper.mapTypeSrc2Tgt(srcType)) {
- continue; // skip this fs - it's not in target type system
- }
-
// probably don't need this test, because change logging is done when a mark is set,
// only for items below the line
- if (!foundFSsBelowMark.contains(fs._id)) {
+ if ((isTypeMapping && null == typeMapper.mapTypeSrc2Tgt(srcType)) || !foundFSsBelowMark.contains(fs._id)) {
// System.out.format(" skipping heap addr %,d%n", currentFsId);
continue;
}
@@ -1687,9 +1679,6 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
* - Because of this,
* -- v2 deserialization can't read v3 serializations
* -- v3 deserialization can read v2 serializatoins, though.
- *
- * @param fsChange
- * @throws IOException
*/
// @formatter:on
private void writeModsForOneFs(FsChange fsChange) throws IOException {
@@ -1728,20 +1717,17 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
writeDiff(int_i, vs, vPrevModShort);
vPrevModShort = vs;
break;
-
case Slot_LongRef: {
final long v = ((LongArray) fs).get(index);
writeLong(v, vPrevModLong);
vPrevModLong = v;
break;
}
-
case Slot_DoubleRef: {
final long v = Double.doubleToRawLongBits(((DoubleArray) fs).get(index));
writeDouble(v);
break;
}
-
case Slot_Int:
vPrevModInt = writeDiff(int_i, ((IntegerArray) fs).get(index), vPrevModInt);
break;
@@ -1862,12 +1848,12 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
*
* @param istream
* input stream
- * @param allowPreexistingFS
+ * @param aAllowPreexistingFS
* what to do if item already exists below the mark
* @throws IOException
* passthru
*/
- public void deserialize(InputStream istream, AllowPreexistingFS allowPreexistingFS)
+ public void deserialize(InputStream istream, AllowPreexistingFS aAllowPreexistingFS)
throws IOException {
Header h = readHeader(istream);
@@ -1880,19 +1866,19 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
throw new UnsupportedOperationException("Delta CAS required for this call");
}
- bcsd.reinit(h, deserIn, null, CasLoadMode.DEFAULT, this, allowPreexistingFS, null);
+ bcsd.reinit(h, deserIn, null, CasLoadMode.DEFAULT, this, aAllowPreexistingFS, null);
}
- public void deserializeAfterVersion(DataInputStream istream, boolean isDelta,
- AllowPreexistingFS allowPreexistingFS) throws IOException {
+ public void deserializeAfterVersion(DataInputStream istream, boolean aIsDelta,
+ AllowPreexistingFS aAllowPreexistingFS) throws IOException {
- this.allowPreexistingFS = allowPreexistingFS;
- if (allowPreexistingFS == AllowPreexistingFS.ignore) {
+ allowPreexistingFS = aAllowPreexistingFS;
+ if (aAllowPreexistingFS == AllowPreexistingFS.ignore) {
throw new UnsupportedOperationException("AllowPreexistingFS.ignore not an allowed setting");
}
deserIn = istream;
- this.isDelta = isReadingDelta = isDelta;
+ isDelta = isReadingDelta = aIsDelta;
setupReadStreams();
/************************************************
@@ -1964,9 +1950,9 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
// @formatter:n
// currentFsId only used in error message
- for (int currentFsId = nextFsId, nbrFSs = 0, nextFsAddr = 1; this.bcsd.isBeforeV3
+ for (int currentFsId = nextFsId, nbrFSs = 0, nextFsAddr = 1; bcsd.isBeforeV3
? nextFsAddr < totalMappedHeapSize
- : nbrFSs < nbrNewFSsInTarget; nbrFSs++, nextFsAddr += this.bcsd.isBeforeV3
+ : nbrFSs < nbrNewFSsInTarget; nbrFSs++, nextFsAddr += bcsd.isBeforeV3
? tgtType.getFsSpaceReq(lastArrayLength)
: 0) {
@@ -2149,13 +2135,10 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
}
/**
- *
- * @param storeIt
* @param srcType
* may be null if there's no source type for target when deserializing
* @param tgtType
* the type being deserialized
- * @throws IOException
*/
private void readArray(boolean storeIt, TypeImpl srcType, TypeImpl tgtType) throws IOException {
final int length = readArrayLength();
@@ -2267,7 +2250,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
// @formatter:off
/**
- * @param The feature structure to set feature value in, but may be null if it was deferred,
+ * @param fs The feature structure to set feature value in, but may be null if it was deferred,
* - happens for Sofas and subtypes of AnnotationBase
* because those have "final" values
* For Sofa: these are the sofaid (String) and sofanum (int)
@@ -2311,7 +2294,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
}
if (srcTs.annotBaseSofaFeat != srcFeat || sofaRef == null) {
- https: // issues.apache.org/jira/browse/UIMA-5588
+ // https://issues.apache.org/jira/browse/UIMA-5588
maybeStoreOrDefer(storeIt, fs, (lfs) -> {
// outer defer done if fs is null; it is a one-feature-structure defer for sofa or
@@ -2439,8 +2422,6 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
/**
* process index information to re-index things
- *
- * @throws IOException
*/
private void readIndexedFeatureStructures() throws IOException {
final int nbrViews = readVnumber(control_dis);
@@ -2667,11 +2648,9 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
}
/**
- *
* @param storeIt
* true to store value, false to skip it
* @return the string
- * @throws IOException
*/
private String readString(boolean storeIt) throws IOException {
final int length = decodeIntSign(readVnumber(strLength_dis));
@@ -2891,7 +2870,6 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
* the modified feature structure
* @param srcType
* the type of the modified feature structure
- * @throws IOException
*/
private void readModifiedMainHeap(int numberOfMods, TOP fs, TypeImpl srcType)
throws IOException {
@@ -3100,15 +3078,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
/**
* processes one view's worth of feature structures
- *
- * @param fsIndexes
- * @param fsNdxStart
- * @param isDoingEnqueue
- * @param isWrite
- * @return
- * @throws IOException
*/
-
private void processFSsForView(final boolean isEnqueue, Stream<TOP> fss) {
// prev id and entries written as a captured value in context
@@ -3155,13 +3125,9 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
}
}
- // @formatter:off
/**
- * Add Fs to toBeProcessed and set foundxxx bit
- * - skip this if doesn't exist in target type system
- * @param fs
+ * Add Fs to toBeProcessed and set foundxxx bit - skip this if doesn't exist in target type system
*/
- // @formatter:on
private void enqueueFS(TOP fs) {
if (null == fs || !isTypeInTgt(fs)) {
return;
@@ -3618,7 +3584,6 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
* fs == null -> 0
* type not in target -> 0
* map src fs._id to tgt seq
- * @param fs
* @return 0 or the mapped src id
*/
// @formatter:on
@@ -3637,7 +3602,7 @@ public class BinaryCasSerDes6 implements SlotKindsConstants {
}
TypeSystemImpl getTgtTs() {
- return this.tgtTs;
+ return tgtTs;
}
// number of views: cas.getNumberOfViews()
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java
index 10eccd236..37f0b1087 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java
@@ -35,12 +35,12 @@ public class BooleanConstraint extends PathConstraint implements FSMatchConstrai
BooleanConstraint(ArrayList<String> path, FSBooleanConstraint constraint) {
super(path);
- this.cons = constraint;
+ cons = constraint;
}
@Override
public boolean match(FeatureStructure fs) {
- final int max = this.featNames.size() - 1; // The last position in the
+ final int max = featNames.size() - 1; // The last position in the
// path!
if (max < 0) {
// If the path is empty, we can't get a boolean, and therefore the
@@ -49,17 +49,17 @@ public class BooleanConstraint extends PathConstraint implements FSMatchConstrai
}
Feature feat;
for (int i = 0; i < max; i++) {
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(i));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(i));
if (feat == null) {
return false;
}
fs = fs.getFeatureValue(feat);
}
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(max));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(max));
if (feat == null) {
return false;
}
- return this.cons.match(fs.getBooleanValue(feat));
+ return cons.match(fs.getBooleanValue(feat));
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/ByteHeap.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/ByteHeap.java
index 6064a3919..ca3fdf906 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/ByteHeap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/ByteHeap.java
@@ -38,17 +38,17 @@ final class ByteHeap extends CommonAuxHeap {
@Override
void initMemory() {
- this.heap = new byte[this.heapBaseSize];
+ heap = new byte[heapBaseSize];
}
@Override
void initMemory(int size) {
- this.heap = new byte[size];
+ heap = new byte[size];
}
@Override
int getCapacity() {
- return this.heap.length;
+ return heap.length;
}
@Override
@@ -64,12 +64,12 @@ final class ByteHeap extends CommonAuxHeap {
@Override
void resetToZeros() {
- Arrays.fill(this.heap, 0, this.heapPos, (byte) NULL);
+ Arrays.fill(heap, 0, heapPos, (byte) NULL);
}
// Getters
byte getHeapValue(int offset) {
- return this.heap[offset];
+ return heap[offset];
}
// setters
@@ -109,7 +109,7 @@ final class ByteHeap extends CommonAuxHeap {
heap = new byte[argLength];
System.arraycopy(byteHeap, 0, heap, 0, argLength);
- this.heapPos = argLength;
+ heapPos = argLength;
}
public byte[] toArray() {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASCompleteSerializer.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASCompleteSerializer.java
index 2ecd0bf16..21dba309e 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASCompleteSerializer.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASCompleteSerializer.java
@@ -44,16 +44,16 @@ public class CASCompleteSerializer implements Serializable {
public CASCompleteSerializer(CASImpl cas) {
this();
- this.casMgrSer = Serialization.serializeCASMgr(cas);
- this.casSer = Serialization.serializeCAS(cas);
+ casMgrSer = Serialization.serializeCASMgr(cas);
+ casSer = Serialization.serializeCAS(cas);
}
public CASMgrSerializer getCASMgrSerializer() {
- return this.casMgrSer;
+ return casMgrSer;
}
public CASSerializer getCASSerializer() {
- return this.casSer;
+ return casSer;
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
index c5bb00e99..14d568c6e 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
@@ -1209,7 +1209,7 @@ public class CASImpl extends AbstractCas_ImplBase
// FSClassRegistry instances
}
- this.svd = new SharedViewData(this, initialHeapSize, ts);
+ svd = new SharedViewData(this, initialHeapSize, ts);
// this.svd.baseCAS = this;
// this.svd.heap = new Heap(initialHeapSize);
@@ -1218,13 +1218,13 @@ public class CASImpl extends AbstractCas_ImplBase
commitTypeSystem();
}
- this.svd.sofa2indexMap = new ArrayList<>();
- this.svd.sofaNbr2ViewMap = new ArrayList<>();
- this.svd.sofaNameSet = new HashSet<>();
- this.svd.initialSofaCreated = false;
- this.svd.viewCount = 0;
+ svd.sofa2indexMap = new ArrayList<>();
+ svd.sofaNbr2ViewMap = new ArrayList<>();
+ svd.sofaNameSet = new HashSet<>();
+ svd.initialSofaCreated = false;
+ svd.viewCount = 0;
- this.svd.clearTrackingMarks();
+ svd.clearTrackingMarks();
}
public CASImpl() {
@@ -1238,35 +1238,35 @@ public class CASImpl extends AbstractCas_ImplBase
checkInternalCodes(ser);
// assert(ts != null);
// assert(getTypeSystem() != null);
- this.indexRepository = ser.getIndexRepository(this);
+ indexRepository = ser.getIndexRepository(this);
}
// Use this when creating a CAS view
CASImpl(CASImpl cas, SofaFS aSofa) {
// these next fields are final and must be set in the constructor
- this.svd = cas.svd;
+ svd = cas.svd;
- this.mySofaRef = (Sofa) aSofa;
+ mySofaRef = (Sofa) aSofa;
// get the indexRepository for this Sofa
- this.indexRepository = (this.mySofaRef == null)
+ indexRepository = (mySofaRef == null)
? (FSIndexRepositoryImpl) cas.getSofaIndexRepository(1)
: (FSIndexRepositoryImpl) cas.getSofaIndexRepository(aSofa);
- if (null == this.indexRepository) {
+ if (null == indexRepository) {
// create the indexRepository for this CAS
// use the baseIR to create a lightweight IR copy
FSIndexRepositoryImpl baseIndexRepo = (FSIndexRepositoryImpl) cas.getBaseIndexRepository();
- this.indexRepository = new FSIndexRepositoryImpl(this, baseIndexRepo);
+ indexRepository = new FSIndexRepositoryImpl(this, baseIndexRepo);
// the index creation depends on "indexRepository" already being set
baseIndexRepo.name2indexMap.keySet().stream()
- .forEach(key -> this.indexRepository.createIndex(baseIndexRepo, key));
- this.indexRepository.commit();
+ .forEach(key -> indexRepository.createIndex(baseIndexRepo, key));
+ indexRepository.commit();
// save new sofa index
- if (this.mySofaRef == null) {
- cas.setSofaIndexRepository(1, this.indexRepository);
+ if (mySofaRef == null) {
+ cas.setSofaIndexRepository(1, indexRepository);
} else {
- cas.setSofaIndexRepository(aSofa, this.indexRepository);
+ cas.setSofaIndexRepository(aSofa, indexRepository);
}
}
}
@@ -1276,29 +1276,29 @@ public class CASImpl extends AbstractCas_ImplBase
if (aSofa != null) {
// save address of SofaFS
- this.mySofaRef = (Sofa) aSofa;
+ mySofaRef = (Sofa) aSofa;
} else {
// this is the InitialView
- this.mySofaRef = null;
+ mySofaRef = null;
}
// toss the JCas, if it exists
- this.jcas = null;
+ jcas = null;
// create the indexRepository for this Sofa
final FSIndexRepositoryImpl baseIndexRepo = (FSIndexRepositoryImpl) ((CASImpl) cas)
.getBaseIndexRepository();
- this.indexRepository = new FSIndexRepositoryImpl(this, baseIndexRepo);
+ indexRepository = new FSIndexRepositoryImpl(this, baseIndexRepo);
// the index creation depends on "indexRepository" already being set
baseIndexRepo.name2indexMap.keySet().stream()
- .forEach(key -> this.indexRepository.createIndex(baseIndexRepo, key));
+ .forEach(key -> indexRepository.createIndex(baseIndexRepo, key));
- this.indexRepository.commit();
+ indexRepository.commit();
// save new sofa index
- if (this.mySofaRef == null) {
- ((CASImpl) cas).setSofaIndexRepository(1, this.indexRepository);
+ if (mySofaRef == null) {
+ ((CASImpl) cas).setSofaIndexRepository(1, indexRepository);
} else {
- ((CASImpl) cas).setSofaIndexRepository(aSofa, this.indexRepository);
+ ((CASImpl) cas).setSofaIndexRepository(aSofa, indexRepository);
}
}
@@ -1402,7 +1402,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public void enableReset(boolean flag) {
- this.svd.flushEnabled = flag;
+ svd.flushEnabled = flag;
}
@Override
@@ -1412,9 +1412,9 @@ public class CASImpl extends AbstractCas_ImplBase
public final TypeSystemImpl getTypeSystemImpl() {
if (tsi_local == null) {
- tsi_local = this.svd.tsi;
+ tsi_local = svd.tsi;
}
- return this.tsi_local;
+ return tsi_local;
}
/**
@@ -1423,14 +1423,14 @@ public class CASImpl extends AbstractCas_ImplBase
* @param ts
*/
void installTypeSystemInAllViews(TypeSystemImpl ts) {
- this.svd.tsi = ts;
- final List<CASImpl> sn2v = this.svd.sofaNbr2ViewMap;
+ svd.tsi = ts;
+ final List<CASImpl> sn2v = svd.sofaNbr2ViewMap;
if (sn2v.size() > 0) {
for (CASImpl view : sn2v.subList(1, sn2v.size())) {
view.tsi_local = ts;
}
}
- this.getBaseCAS().tsi_local = ts;
+ getBaseCAS().tsi_local = ts;
}
@Override
@@ -1620,15 +1620,11 @@ public class CASImpl extends AbstractCas_ImplBase
// return true if only one sofa and it is the default text sofa
public boolean isBackwardCompatibleCas() {
// check that there is exactly one sofa
- if (this.svd.viewCount != 1) {
+ if ((svd.viewCount != 1) || !svd.initialSofaCreated) {
return false;
}
- if (!this.svd.initialSofaCreated) {
- return false;
- }
-
- Sofa sofa = this.getInitialView().getSofa();
+ Sofa sofa = getInitialView().getSofa();
// check for mime type exactly equal to "text"
String sofaMime = sofa.getMimeType();
@@ -1650,7 +1646,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
int getViewCount() {
- return this.svd.viewCount;
+ return svd.viewCount;
}
FSIndexRepository getSofaIndexRepository(SofaFS aSofa) {
@@ -1658,10 +1654,10 @@ public class CASImpl extends AbstractCas_ImplBase
}
FSIndexRepositoryImpl getSofaIndexRepository(int aSofaRef) {
- if (aSofaRef >= this.svd.sofa2indexMap.size()) {
+ if (aSofaRef >= svd.sofa2indexMap.size()) {
return null;
}
- return this.svd.sofa2indexMap.get(aSofaRef);
+ return svd.sofa2indexMap.get(aSofaRef);
}
void setSofaIndexRepository(SofaFS aSofa, FSIndexRepositoryImpl indxRepos) {
@@ -1669,7 +1665,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
void setSofaIndexRepository(int aSofaRef, FSIndexRepositoryImpl indxRepos) {
- Misc.setWithExpand(this.svd.sofa2indexMap, aSofaRef, indxRepos);
+ Misc.setWithExpand(svd.sofa2indexMap, aSofaRef, indxRepos);
}
@Override
@@ -1684,36 +1680,36 @@ public class CASImpl extends AbstractCas_ImplBase
}
Sofa createSofa(String sofaName, String mimeType) {
- return createSofa(++this.svd.viewCount, sofaName, mimeType);
+ return createSofa(++svd.viewCount, sofaName, mimeType);
}
Sofa createSofa(int sofaNum, String sofaName, String mimeType) {
- if (this.svd.sofaNameSet.contains(sofaName)) {
+ if (svd.sofaNameSet.contains(sofaName)) {
throw new CASRuntimeException(CASRuntimeException.SOFANAME_ALREADY_EXISTS, sofaName);
}
- final boolean viewAlreadyExists = sofaNum == this.svd.viewCount;
+ final boolean viewAlreadyExists = sofaNum == svd.viewCount;
if (!viewAlreadyExists) {
if (sofaNum == 1) { // skip the test for sofaNum == 1 - this can be set "later"
- if (this.svd.viewCount == 0) {
- this.svd.viewCount = 1;
+ if (svd.viewCount == 0) {
+ svd.viewCount = 1;
} // else it is == or higher, so don't reset it down
} else { // sofa is not initial sofa - is guaranteed to be set when view created
// if (sofaNum != this.svd.viewCount + 1) {
// System.out.println("debug");
// }
- assert (sofaNum == this.svd.viewCount + 1);
- this.svd.viewCount = sofaNum;
+ assert (sofaNum == svd.viewCount + 1);
+ svd.viewCount = sofaNum;
}
}
- Sofa sofa = new Sofa(getTypeSystemImpl().sofaType, this.getBaseCAS(), // view for a sofa is the
+ Sofa sofa = new Sofa(getTypeSystemImpl().sofaType, getBaseCAS(), // view for a sofa is the
// base cas to correspond
// to where it gets
// indexed
sofaNum, sofaName, mimeType);
- this.getBaseIndexRepository().addFS(sofa);
- this.svd.sofaNameSet.add(sofaName);
+ getBaseIndexRepository().addFS(sofa);
+ svd.sofaNameSet.add(sofaName);
if (!viewAlreadyExists) {
getView(sofa); // create the view that goes with this Sofa
}
@@ -1721,23 +1717,23 @@ public class CASImpl extends AbstractCas_ImplBase
}
boolean hasView(String name) {
- return this.svd.sofaNameSet.contains(name);
+ return svd.sofaNameSet.contains(name);
}
Sofa createInitialSofa(String mimeType) {
Sofa sofa = createSofa(1, CAS.NAME_DEFAULT_SOFA, mimeType);
registerInitialSofa();
- this.mySofaRef = sofa;
+ mySofaRef = sofa;
return sofa;
}
void registerInitialSofa() {
- this.svd.initialSofaCreated = true;
+ svd.initialSofaCreated = true;
}
boolean isInitialSofaCreated() {
- return this.svd.initialSofaCreated;
+ return svd.initialSofaCreated;
}
/**
@@ -1751,7 +1747,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
private SofaFS getSofa(String sofaName) {
- FSIterator<Sofa> iterator = this.svd.baseCAS.getSofaIterator();
+ FSIterator<Sofa> iterator = svd.baseCAS.getSofaIterator();
while (iterator.hasNext()) {
SofaFS sofa = iterator.next();
if (sofaName.equals(sofa.getSofaID())) {
@@ -1783,23 +1779,23 @@ public class CASImpl extends AbstractCas_ImplBase
}
public CASImpl getBaseCAS() {
- return this.svd.baseCAS;
+ return svd.baseCAS;
}
@Override
public <T extends SofaFS> FSIterator<T> getSofaIterator() {
- FSIndex<T> sofaIndex = this.svd.baseCAS.indexRepository.<T> getIndex(CAS.SOFA_INDEX_NAME);
+ FSIndex<T> sofaIndex = svd.baseCAS.indexRepository.<T> getIndex(CAS.SOFA_INDEX_NAME);
return sofaIndex.iterator();
}
// For internal use only
public Sofa getSofaRef() {
- if (this.mySofaRef == null) {
+ if (mySofaRef == null) {
// create the SofaFS for _InitialView ...
// ... and reset mySofaRef to point to it
- this.mySofaRef = this.createInitialSofa(null);
+ mySofaRef = createInitialSofa(null);
}
- return this.mySofaRef;
+ return mySofaRef;
}
// For internal use only
@@ -1932,18 +1928,18 @@ public class CASImpl extends AbstractCas_ImplBase
}
private void createIndexRepository() {
- if (!this.getTypeSystemMgr().isCommitted()) {
+ if (!getTypeSystemMgr().isCommitted()) {
throw new CASAdminException(CASAdminException.MUST_COMMIT_TYPE_SYSTEM);
}
- if (this.indexRepository == null) {
- this.indexRepository = new FSIndexRepositoryImpl(this);
+ if (indexRepository == null) {
+ indexRepository = new FSIndexRepositoryImpl(this);
}
}
@Override
public FSIndexRepositoryMgr getIndexRepositoryMgr() {
// assert(this.cas.getIndexRepository() != null);
- return this.indexRepository;
+ return indexRepository;
}
@Deprecated
@@ -1971,13 +1967,13 @@ public class CASImpl extends AbstractCas_ImplBase
if (isCasLocked()) {
throw new CASAdminException(CASAdminException.FLUSH_DISABLED);
}
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
resetNoQuestions();
return;
}
// called from a CAS view.
// clear CAS ...
- this.svd.baseCAS.resetNoQuestions();
+ svd.baseCAS.resetNoQuestions();
}
public void resetNoQuestions() {
@@ -1995,33 +1991,33 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public FSIndexRepository getIndexRepository() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// BaseCas has no indexes for users
return null;
}
- if (this.indexRepository.isCommitted()) {
- return this.indexRepository;
+ if (indexRepository.isCommitted()) {
+ return indexRepository;
}
return null;
}
FSIndexRepository getBaseIndexRepository() {
- if (this.svd.baseCAS.indexRepository.isCommitted()) {
- return this.svd.baseCAS.indexRepository;
+ if (svd.baseCAS.indexRepository.isCommitted()) {
+ return svd.baseCAS.indexRepository;
}
return null;
}
FSIndexRepositoryImpl getBaseIndexRepositoryImpl() {
- return this.svd.baseCAS.indexRepository;
+ return svd.baseCAS.indexRepository;
}
void addSofaFsToIndex(SofaFS sofa) {
- this.svd.baseCAS.getBaseIndexRepository().addFS(sofa);
+ svd.baseCAS.getBaseIndexRepository().addFS(sofa);
}
void registerView(Sofa aSofa) {
- this.mySofaRef = aSofa;
+ mySofaRef = aSofa;
}
/**
@@ -2038,7 +2034,7 @@ public class CASImpl extends AbstractCas_ImplBase
*/
@Override
public CAS getCAS() {
- if (this.indexRepository.isCommitted()) {
+ if (indexRepository.isCommitted()) {
return this;
}
throw new CASAdminException(CASAdminException.MUST_COMMIT_INDEX_REPOSITORY);
@@ -2071,7 +2067,7 @@ public class CASImpl extends AbstractCas_ImplBase
// log the FS
- final Map<TOP, FsChange> changes = this.svd.modifiedPreexistingFSs;
+ final Map<TOP, FsChange> changes = svd.modifiedPreexistingFSs;
// create or use last FsChange element
@@ -2095,7 +2091,7 @@ public class CASImpl extends AbstractCas_ImplBase
// log the FS
- final Map<TOP, FsChange> changes = this.svd.modifiedPreexistingFSs;
+ final Map<TOP, FsChange> changes = svd.modifiedPreexistingFSs;
// create or use last FsChange element
@@ -2187,7 +2183,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
public final boolean isLoggingNeeded(FeatureStructureImplC fs) {
- return this.svd.trackingMark != null && !this.svd.trackingMark.isNew(fs._id);
+ return svd.trackingMark != null && !svd.trackingMark.isNew(fs._id);
}
/**
@@ -2243,7 +2239,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
final public boolean isLogging() {
- return this.svd.trackingMark != null;
+ return svd.trackingMark != null;
}
// /**
@@ -2538,17 +2534,17 @@ public class CASImpl extends AbstractCas_ImplBase
throw new CASException(CASException.MUST_COMMIT_TYPE_SYSTEM);
}
- FSIndexComparator comp = this.indexRepository.createComparator();
+ FSIndexComparator comp = indexRepository.createComparator();
comp.setType(ts.sofaType);
comp.addKey(ts.sofaNum, FSIndexComparator.STANDARD_COMPARE);
- this.indexRepository.createIndex(comp, CAS.SOFA_INDEX_NAME, FSIndex.BAG_INDEX);
+ indexRepository.createIndex(comp, CAS.SOFA_INDEX_NAME, FSIndex.BAG_INDEX);
- comp = this.indexRepository.createComparator();
+ comp = indexRepository.createComparator();
comp.setType(ts.annotType);
comp.addKey(ts.startFeat, FSIndexComparator.STANDARD_COMPARE);
comp.addKey(ts.endFeat, FSIndexComparator.REVERSE_STANDARD_COMPARE);
- comp.addKey(this.indexRepository.getDefaultTypeOrder(), FSIndexComparator.STANDARD_COMPARE);
- this.indexRepository.createIndex(comp, CAS.STD_ANNOTATION_INDEX);
+ comp.addKey(indexRepository.getDefaultTypeOrder(), FSIndexComparator.STANDARD_COMPARE);
+ indexRepository.createIndex(comp, CAS.STD_ANNOTATION_INDEX);
}
// ///////////////////////////////////////////////////////////////////////////
@@ -2569,18 +2565,18 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public JCas getJCas() {
- if (this.jcas == null) {
- this.jcas = JCasImpl.getJCas(this);
+ if (jcas == null) {
+ jcas = JCasImpl.getJCas(this);
}
- return this.jcas;
+ return jcas;
}
@Override
public JCasImpl getJCasImpl() {
- if (this.jcas == null) {
- this.jcas = JCasImpl.getJCas(this);
+ if (jcas == null) {
+ jcas = JCasImpl.getJCas(this);
}
- return this.jcas;
+ return jcas;
}
// /**
@@ -2596,7 +2592,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public JCas getJCas(SofaFS aSofa) throws CASException {
// Create base JCas, if needed
- this.svd.baseCAS.getJCas();
+ svd.baseCAS.getJCas();
return getView(aSofa).getJCas();
/*
@@ -2696,7 +2692,7 @@ public class CASImpl extends AbstractCas_ImplBase
// which is now creating the associated view
// create a new CAS view
- aView = new CASImpl(this.svd.baseCAS, sofa);
+ aView = new CASImpl(svd.baseCAS, sofa);
svd.setViewForSofaNbr(sofaNbr, aView);
verifySofaNameUniqueIfDeserializedViewAdded(sofaNbr, sofa);
return aView;
@@ -2731,7 +2727,7 @@ public class CASImpl extends AbstractCas_ImplBase
* input, which would make this logic fail.
*/
private void verifySofaNameUniqueIfDeserializedViewAdded(int sofaNbr, SofaFS aSofa) {
- final int curViewCount = this.svd.viewCount;
+ final int curViewCount = svd.viewCount;
if (curViewCount < sofaNbr) {
// Only true for deserialized sofas with new views being either created,
// or
@@ -2739,14 +2735,14 @@ public class CASImpl extends AbstractCas_ImplBase
// views.
// Assume sofa numbers are incrementing by 1
assert (sofaNbr == curViewCount + 1);
- this.svd.viewCount = sofaNbr;
+ svd.viewCount = sofaNbr;
String id = aSofa.getSofaID();
// final Feature idFeat =
// getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFAID);
// String id =
// ll_getStringValue(((FeatureStructureImpl)aSofa).getAddress(),
// ((FeatureImpl) idFeat).getCode());
- Misc.assertUie(this.svd.sofaNameSet.contains(id));
+ Misc.assertUie(svd.sofaNameSet.contains(id));
// this.svd.sofaNameSet.add(id);
}
}
@@ -2768,7 +2764,7 @@ public class CASImpl extends AbstractCas_ImplBase
*/
@Override
public LowLevelIndexRepository ll_getIndexRepository() {
- return this.indexRepository;
+ return indexRepository;
}
/**
@@ -4002,7 +3998,7 @@ public class CASImpl extends AbstractCas_ImplBase
*/
@Override
public ClassLoader getJCasClassLoader() {
- return this.svd.jcasClassLoader;
+ return svd.jcasClassLoader;
}
/*
@@ -4012,11 +4008,11 @@ public class CASImpl extends AbstractCas_ImplBase
*/
@Override
public void setJCasClassLoader(ClassLoader classLoader) {
- this.svd.jcasClassLoader = classLoader;
+ svd.jcasClassLoader = classLoader;
}
public void switchClassLoader(ClassLoader newClassLoader, boolean wasLocked) {
- this.svd.switchClassLoader(newClassLoader, wasLocked);
+ svd.switchClassLoader(newClassLoader, wasLocked);
}
// Internal use only, public for cross package use
@@ -4049,8 +4045,8 @@ public class CASImpl extends AbstractCas_ImplBase
// }
public void restoreClassLoaderUnlockCas() {
- boolean empty_switchControl = this.svd.switchControl.isEmpty();
- SwitchControl switchControlInstance = empty_switchControl ? null : this.svd.switchControl.pop();
+ boolean empty_switchControl = svd.switchControl.isEmpty();
+ SwitchControl switchControlInstance = empty_switchControl ? null : svd.switchControl.pop();
if (empty_switchControl || !switchControlInstance.wasLocked) {
// unlock CAS functions
enableReset(true);
@@ -4511,10 +4507,10 @@ public class CASImpl extends AbstractCas_ImplBase
*/
// @formatter:on
public void updateDocumentAnnotation() {
- if (!mySofaIsValid() || this == this.svd.baseCAS) {
+ if (!mySofaIsValid() || this == svd.baseCAS) {
return;
}
- String newDoc = this.mySofaRef.getLocalStringData();
+ String newDoc = mySofaRef.getLocalStringData();
if (null != newDoc) {
Annotation docAnnot = getDocumentAnnotationNoCreate();
if (docAnnot != null) {
@@ -4556,7 +4552,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
public <T extends AnnotationFS> T getDocumentAnnotationNoCreate() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no document
return null;
}
@@ -4592,7 +4588,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public String getDocumentLanguage() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no document
return null;
}
@@ -4601,12 +4597,12 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public String getDocumentText() {
- return this.getSofaDataString();
+ return getSofaDataString();
}
@Override
public String getSofaDataString() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no document
return null;
}
@@ -4615,7 +4611,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public FeatureStructure getSofaDataArray() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no Sofa
return null;
}
@@ -4624,7 +4620,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public String getSofaDataURI() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no Sofa
return null;
}
@@ -4633,7 +4629,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public InputStream getSofaDataStream() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no Sofa nothin
return null;
}
@@ -4644,7 +4640,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public String getSofaMimeType() {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
// base CAS has no Sofa
return null;
}
@@ -4671,7 +4667,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
private boolean mySofaIsValid() {
- return this.mySofaRef != null;
+ return mySofaRef != null;
}
void setDocTextFromDeserializtion(String text) {
@@ -4683,7 +4679,7 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public void setDocumentLanguage(String languageCode) {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
throw new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD,
"setDocumentLanguage(String)");
}
@@ -4691,13 +4687,13 @@ public class CASImpl extends AbstractCas_ImplBase
FeatureImpl languageFeature = getTypeSystemImpl().langFeat;
languageCode = Language.normalize(languageCode);
boolean wasRemoved = this.checkForInvalidFeatureSetting(docAnnot, languageFeature.getCode(),
- this.getAddbackSingle());
+ getAddbackSingle());
docAnnot.setStringValue(getTypeSystemImpl().langFeat, languageCode);
addbackSingleIfWasRemoved(wasRemoved, docAnnot);
}
private void setSofaThingsMime(Consumer<Sofa> c, String msg) {
- if (this == this.svd.baseCAS) {
+ if (this == svd.baseCAS) {
throw new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD, msg);
}
Sofa sofa = getSofaRef();
@@ -4728,11 +4724,11 @@ public class CASImpl extends AbstractCas_ImplBase
@Override
public void setCurrentComponentInfo(ComponentInfo info) {
// always store component info in base CAS
- this.svd.componentInfo = info;
+ svd.componentInfo = info;
}
ComponentInfo getCurrentComponentInfo() {
- return this.svd.componentInfo;
+ return svd.componentInfo;
}
/**
@@ -4749,7 +4745,7 @@ public class CASImpl extends AbstractCas_ImplBase
// throw e;
// }
// }
- this.indexRepository.addFS(fs);
+ indexRepository.addFS(fs);
}
/**
@@ -4757,7 +4753,7 @@ public class CASImpl extends AbstractCas_ImplBase
*/
@Override
public void removeFsFromIndexes(FeatureStructure fs) {
- this.indexRepository.removeFS(fs);
+ indexRepository.removeFS(fs);
}
/**
@@ -4806,12 +4802,12 @@ public class CASImpl extends AbstractCas_ImplBase
*/
public int getNumberOfViews() {
CASImpl initialView = getInitialView(); // creates one if not existing, w/o sofa
- int nbrSofas = this.svd.baseCAS.indexRepository.getIndex(CAS.SOFA_INDEX_NAME).size();
+ int nbrSofas = svd.baseCAS.indexRepository.getIndex(CAS.SOFA_INDEX_NAME).size();
return initialView.mySofaIsValid() ? nbrSofas : 1 + nbrSofas;
}
public int getNumberOfSofas() {
- return this.svd.baseCAS.indexRepository.getIndex(CAS.SOFA_INDEX_NAME).size();
+ return svd.baseCAS.indexRepository.getIndex(CAS.SOFA_INDEX_NAME).size();
}
/*
@@ -4914,7 +4910,7 @@ public class CASImpl extends AbstractCas_ImplBase
* action to perform on the views.
*/
public void forAllViews(Consumer<CASImpl> processViews) {
- final int numViews = this.getNumberOfViews();
+ final int numViews = getNumberOfViews();
for (int viewNbr = 1; viewNbr <= numViews; viewNbr++) {
CASImpl view = (viewNbr == 1) ? getInitialView() : (CASImpl) getView(viewNbr);
processViews.accept(view);
@@ -4940,7 +4936,7 @@ public class CASImpl extends AbstractCas_ImplBase
* the code to execute
*/
void forAllIndexRepos(Consumer<FSIndexRepositoryImpl> processIr) {
- final int numViews = this.getViewCount();
+ final int numViews = getViewCount();
for (int viewNum = 1; viewNum <= numViews; viewNum++) {
processIr.accept(this.getSofaIndexRepository(viewNum));
}
@@ -5080,21 +5076,21 @@ public class CASImpl extends AbstractCas_ImplBase
if (isCasLocked()) {
throw new CASAdminException(CASAdminException.FLUSH_DISABLED);
}
- this.svd.trackingMark = new MarkerImpl(this.getLastUsedFsId() + 1, this);
- if (this.svd.modifiedPreexistingFSs == null) {
- this.svd.modifiedPreexistingFSs = new IdentityHashMap<>();
+ svd.trackingMark = new MarkerImpl(getLastUsedFsId() + 1, this);
+ if (svd.modifiedPreexistingFSs == null) {
+ svd.modifiedPreexistingFSs = new IdentityHashMap<>();
}
- if (this.svd.modifiedPreexistingFSs.size() > 0) {
+ if (svd.modifiedPreexistingFSs.size() > 0) {
errorMultipleMarkers();
}
- if (this.svd.trackingMarkList == null) {
- this.svd.trackingMarkList = new ArrayList<>();
+ if (svd.trackingMarkList == null) {
+ svd.trackingMarkList = new ArrayList<>();
} else {
errorMultipleMarkers();
}
- this.svd.trackingMarkList.add(this.svd.trackingMark);
- return this.svd.trackingMark;
+ svd.trackingMarkList.add(svd.trackingMark);
+ return svd.trackingMark;
}
private void errorMultipleMarkers() {
@@ -5103,7 +5099,7 @@ public class CASImpl extends AbstractCas_ImplBase
// made public https://issues.apache.org/jira/browse/UIMA-2478
public MarkerImpl getCurrentMark() {
- return this.svd.trackingMark;
+ return svd.trackingMark;
}
/**
@@ -5111,14 +5107,14 @@ public class CASImpl extends AbstractCas_ImplBase
* @return an array of FsChange items, one per modified Fs, sorted in order of fs._id
*/
FsChange[] getModifiedFSList() {
- final Map<TOP, FsChange> mods = this.svd.modifiedPreexistingFSs;
+ final Map<TOP, FsChange> mods = svd.modifiedPreexistingFSs;
FsChange[] r = mods.values().toArray(new FsChange[mods.size()]);
Arrays.sort(r, 0, mods.size(), (c1, c2) -> Integer.compare(c1.fs._id, c2.fs._id));
return r;
}
boolean isInModifiedPreexisting(TOP fs) {
- return this.svd.modifiedPreexistingFSs.containsKey(fs);
+ return svd.modifiedPreexistingFSs.containsKey(fs);
}
@Override
@@ -5205,7 +5201,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
public <T extends TOP> T getFsFromId(int id) {
- return (T) this.svd.id2fs.get(id);
+ return (T) svd.id2fs.get(id);
}
// /**
@@ -5287,7 +5283,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
public boolean isInCAS(FeatureStructure fs) {
- return ((TOP) fs)._casView.getBaseCAS() == this.getBaseCAS();
+ return ((TOP) fs)._casView.getBaseCAS() == getBaseCAS();
}
// /**
@@ -5579,7 +5575,7 @@ public class CASImpl extends AbstractCas_ImplBase
}
CommonSerDesSequential newCsds() {
- return svd.csds = new CommonSerDesSequential(this.getBaseCAS());
+ return svd.csds = new CommonSerDesSequential(getBaseCAS());
}
/**
@@ -5914,9 +5910,9 @@ public class CASImpl extends AbstractCas_ImplBase
MeasureSwitchType(TypeImpl oldType, TypeImpl newType) {
this.oldType = oldType;
- this.oldJCasClassName = oldType.getJavaClass().getName();
+ oldJCasClassName = oldType.getJavaClass().getName();
this.newType = newType;
- this.newJCasClassName = newType.getJavaClass().getName();
+ newJCasClassName = newType.getJavaClass().getName();
}
@Override
@@ -5935,10 +5931,7 @@ public class CASImpl extends AbstractCas_ImplBase
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof MeasureSwitchType)) {
+ if ((obj == null) || !(obj instanceof MeasureSwitchType)) {
return false;
}
MeasureSwitchType other = (MeasureSwitchType) obj;
@@ -6049,7 +6042,7 @@ public class CASImpl extends AbstractCas_ImplBase
* @return the initial heap size specified or defaulted
*/
public int getInitialHeapSize() {
- return this.svd.initialHeapSize;
+ return svd.initialHeapSize;
}
// backwards compatibility - reinit calls
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
index b8fb60542..1ff4066c2 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
@@ -192,7 +192,7 @@ public class CASMgrSerializer implements Serializable {
*/
public void addIndexRepository(FSIndexRepositoryImpl ir) {
// Encode the type order.
- this.typeOrder = ir.getDefaultTypeOrder().getOrder();
+ typeOrder = ir.getDefaultTypeOrder().getOrder();
// Collect the index labels in a list, as we don't know how many there
// are.
final List<String> names = new ArrayList<>();
@@ -208,28 +208,28 @@ public class CASMgrSerializer implements Serializable {
// Now we know how many labels there are.
final int numNames = names.size();
// Create the array for the labels.
- this.indexNames = new String[numNames];
+ indexNames = new String[numNames];
String label;
// Fill the name array.
for (int i = 0; i < numNames; i++) {
// Get the next label.
label = names.get(i);
// Add the label.
- this.indexNames[i] = label;
+ indexNames[i] = label;
}
// Create a vector of the indexes, and build the name-to-index map.
- this.nameToIndexMap = new int[numNames];
+ nameToIndexMap = new int[numNames];
Vector<FSIndex<FeatureStructure>> indexVector = new Vector<>();
FSIndex<FeatureStructure> index;
int pos;
for (int i = 0; i < numNames; i++) {
- index = ir.getIndex(this.indexNames[i]);
+ index = ir.getIndex(indexNames[i]);
pos = indexVector.indexOf(index);
if (pos < 0) { // if we haven't yet recorded this index in indexVector
indexVector.add(index); // add it to the indexVector
pos = indexVector.size() - 1; // set the pos to the entry just added
}
- this.nameToIndexMap[i] = pos; // store the position of the index in the indexVector in this
+ nameToIndexMap[i] = pos; // store the position of the index in the indexVector in this
// map
}
// Now we know how many indexes there are.
@@ -242,13 +242,13 @@ public class CASMgrSerializer implements Serializable {
// ((TypeImpl) ((FSIndex) indexVector.get(i)).getType()).getCode();
// }
// Create the array with the indexing strategy.
- this.indexingStrategy = new int[numIndexes];
+ indexingStrategy = new int[numIndexes];
for (int i = 0; i < numIndexes; i++) {
- this.indexingStrategy[i] = indexVector.get(i).getIndexingStrategy();
+ indexingStrategy[i] = indexVector.get(i).getIndexingStrategy();
}
// Create the array for the comparator index.
- this.comparatorIndex = new int[numIndexes];
+ comparatorIndex = new int[numIndexes];
// Put the comparators in an IntVector since we don't know how long it
// will get.
IntVector comps = new IntVector();
@@ -260,7 +260,7 @@ public class CASMgrSerializer implements Serializable {
for (int i = 0; i < numIndexes; i++) {
// Set the comparator index to the current position in comparator
// array.
- this.comparatorIndex[i] = compPos;
+ comparatorIndex[i] = compPos;
// Get the comparator.
comp = ((LowLevelIndex<FeatureStructure>) indexVector.get(i)).getComparatorForIndexSpecs();
// Encode the type of the comparator.
@@ -288,11 +288,11 @@ public class CASMgrSerializer implements Serializable {
compPos += 1 + (2 * numCompFeats);
}
// Set the comparator array.
- this.comparators = comps.toArray();
+ comparators = comps.toArray();
}
public void addTypeSystem(TypeSystemImpl ts) {
- this.typeNames = ts.types.stream().map(type -> (null == type) ? null : type.getName())
+ typeNames = ts.types.stream().map(type -> (null == type) ? null : type.getName())
.toArray(String[]::new);
encodeTypeInheritance(ts);
encodeFeatureDecls(ts);
@@ -302,8 +302,8 @@ public class CASMgrSerializer implements Serializable {
private void encodeStringSubtypes(TypeSystemImpl ts) {
Vector<Type> list = getStringSubtypes(ts);
final int size = list.size();
- this.stringSubtypes = new int[size];
- this.stringSubtypeValuePos = new int[size];
+ stringSubtypes = new int[size];
+ stringSubtypeValuePos = new int[size];
List<String> strVals = new ArrayList<>();
TypeImpl_string type;
int pos = 0, typeCode;
@@ -311,17 +311,17 @@ public class CASMgrSerializer implements Serializable {
for (int i = 0; i < size; i++) {
type = (TypeImpl_string) list.get(i);
typeCode = type.getCode();
- this.stringSubtypes[i] = typeCode;
- this.stringSubtypeValuePos[i] = pos;
+ stringSubtypes[i] = typeCode;
+ stringSubtypeValuePos[i] = pos;
stringSet = ts.ll_getStringSet(typeCode);
pos += stringSet.length;
for (int j = 0; j < stringSet.length; j++) {
strVals.add(stringSet[j]);
}
}
- this.stringSubtypeValues = new String[strVals.size()];
+ stringSubtypeValues = new String[strVals.size()];
for (int i = 0; i < strVals.size(); i++) {
- this.stringSubtypeValues[i] = strVals.get(i);
+ stringSubtypeValues[i] = strVals.get(i);
}
}
@@ -348,32 +348,32 @@ public class CASMgrSerializer implements Serializable {
private void encodeFeatureDecls(TypeSystemImpl ts) {
final int max = ts.getSmallestFeature() + ts.getNumberOfFeatures();
- this.featureNames = new String[max];
- this.featDecls = new int[max * 3];
+ featureNames = new String[max];
+ featDecls = new int[max * 3];
Feature f;
for (int i = ts.getSmallestFeature(); i < max; i++) {
f = ts.ll_getFeatureForCode(i);
- this.featureNames[i] = f.getShortName();
- this.featDecls[i * 3] = ((TypeImpl) f.getDomain()).getCode();
- this.featDecls[(i * 3) + 1] = ((TypeImpl) f.getRange()).getCode();
- this.featDecls[(i * 3) + 2] = f.isMultipleReferencesAllowed() ? 1 : 0;
+ featureNames[i] = f.getShortName();
+ featDecls[i * 3] = ((TypeImpl) f.getDomain()).getCode();
+ featDecls[(i * 3) + 1] = ((TypeImpl) f.getRange()).getCode();
+ featDecls[(i * 3) + 2] = f.isMultipleReferencesAllowed() ? 1 : 0;
}
}
private void encodeTypeInheritance(TypeSystemImpl ts) {
final int tsize = ts.getTypeArraySize();
- this.typeInheritance = new int[tsize];
+ typeInheritance = new int[tsize];
// The smallest type is top, which doesn't inherit.
int i = ts.getSmallestType() + 1;
for (TypeImpl t : ts.types.subList(2, tsize)) {
- this.typeInheritance[i++] = t.getSuperType().getCode();
+ typeInheritance[i++] = t.getSuperType().getCode();
}
}
// Ouch.
private int isStringSubtype(int type) {
- for (int i = 0; i < this.stringSubtypes.length; i++) {
- if (this.stringSubtypes[i] == type) {
+ for (int i = 0; i < stringSubtypes.length; i++) {
+ if (stringSubtypes[i] == type) {
return i;
}
}
@@ -391,14 +391,14 @@ public class CASMgrSerializer implements Serializable {
private String[] getStringArray(int pos) {
int end;
- if (pos == this.stringSubtypes.length - 1) {
+ if (pos == stringSubtypes.length - 1) {
// last entry in list, get all the rest
- end = this.stringSubtypeValues.length;
+ end = stringSubtypeValues.length;
} else {
// else get up to the next entry
- end = this.stringSubtypeValuePos[pos + 1];
+ end = stringSubtypeValuePos[pos + 1];
}
- return getSubarray(this.stringSubtypeValues, this.stringSubtypeValuePos[pos], end);
+ return getSubarray(stringSubtypeValues, stringSubtypeValuePos[pos], end);
}
public TypeSystemImpl getTypeSystem() {
@@ -429,8 +429,8 @@ public class CASMgrSerializer implements Serializable {
// }
// }
// } else {
- for (int i = 2; i < this.typeNames.length; i++) {
- name = this.typeNames[i];
+ for (int i = 2; i < typeNames.length; i++) {
+ name = typeNames[i];
int pos = isStringSubtype(i);
if (pos >= 0) {
ts.addStringSubtype(name, getStringArray(pos));
@@ -438,21 +438,21 @@ public class CASMgrSerializer implements Serializable {
ts.getArrayType(ts.getType(TypeSystemImpl.getArrayComponentName(name)));
} else {
if (ts.getType(name) == null) {
- ts.addType(name, ts.ll_getTypeForCode(this.typeInheritance[i]));
+ ts.addType(name, ts.ll_getTypeForCode(typeInheritance[i]));
}
}
}
// Add feature declarations.
- final int max = this.featureNames.length;
+ final int max = featureNames.length;
for (int i = 1; i < max; i++) {
// if (this.source == SOURCE_TAF) {
// name = CASImpl.mapName(this.featureNames[i], nameMap);
// } else {
- name = this.featureNames[i];
+ name = featureNames[i];
// }
- ts.addFeature(name, ts.getTypeForCode(this.featDecls[i * 3]),
- ts.getTypeForCode(this.featDecls[(i * 3) + 1]), this.featDecls[(i * 3) + 2] == 1);
+ ts.addFeature(name, ts.getTypeForCode(featDecls[i * 3]),
+ ts.getTypeForCode(featDecls[(i * 3) + 1]), featDecls[(i * 3) + 2] == 1);
}
return ts;
}
@@ -472,64 +472,64 @@ public class CASMgrSerializer implements Serializable {
// index creation refs via the cas the index repository
// Get the type order.
ir.setDefaultTypeOrder(
- LinearTypeOrderBuilderImpl.createTypeOrder(this.typeOrder, cas.getTypeSystem()));
+ LinearTypeOrderBuilderImpl.createTypeOrder(typeOrder, cas.getTypeSystem()));
FSIndexComparator comp;
- final int max = this.indexNames.length;
+ final int max = indexNames.length;
int pos = 0, next, maxComp;
Type type;
Feature feat;
- if (this.nameToIndexMap == null) { // if nameToIndexMap is null
- this.nameToIndexMap = new int[max]; // create an identity map by default
+ if (nameToIndexMap == null) { // if nameToIndexMap is null
+ nameToIndexMap = new int[max]; // create an identity map by default
for (int i = 0; i < max; i++) {
- this.nameToIndexMap[i] = i;
+ nameToIndexMap[i] = i;
}
}
for (int i = 0; i < max; i++) {
comp = ir.createComparator();
// assert(pos == comparatorIndex[i]);
- pos = this.comparatorIndex[this.nameToIndexMap[i]]; // pos jumps by odd numbers, 1: type, 2-3,
+ pos = comparatorIndex[nameToIndexMap[i]]; // pos jumps by odd numbers, 1: type, 2-3,
// 4-5 etc are pairs: feature code and
// direction
- type = cas.getTypeSystemImpl().ll_getTypeForCode(this.comparators[pos]);
+ type = cas.getTypeSystemImpl().ll_getTypeForCode(comparators[pos]);
comp.setType(type);
++pos;
// set the end of the feat/dir pairs to the next item or the length of the array if the last
// item
- next = this.nameToIndexMap[i] + 1;
+ next = nameToIndexMap[i] + 1;
if (next < max) {
- maxComp = this.comparatorIndex[next];
+ maxComp = comparatorIndex[next];
} else {
- maxComp = this.comparators.length;
+ maxComp = comparators.length;
}
TypeSystemImpl tsi = (TypeSystemImpl) cas.getTypeSystem();
while (pos < maxComp) {
// System.out.println("Type system: " +
// cas.getTypeSystem().toString());
- if (this.comparators[pos] > 0) {
- feat = tsi.ll_getFeatureForCode(this.comparators[pos]);
+ if (comparators[pos] > 0) {
+ feat = tsi.ll_getFeatureForCode(comparators[pos]);
// assert(feat != null);
// System.out.println("Adding feature: " + feat.getName());
++pos;
- comp.addKey(feat, this.comparators[pos]);
+ comp.addKey(feat, comparators[pos]);
// assert(rc >= 0);
} else {
LinearTypeOrder order = ir.getDefaultTypeOrder();
++pos;
- comp.addKey(order, this.comparators[pos]); // the direction is always standard, never
+ comp.addKey(order, comparators[pos]); // the direction is always standard, never
// reverse
}
++pos;
}
- ir.createIndex(comp, this.indexNames[i], this.indexingStrategy[this.nameToIndexMap[i]]);
+ ir.createIndex(comp, indexNames[i], indexingStrategy[nameToIndexMap[i]]);
}
ir.commit();
return ir;
}
public boolean hasIndexRepository() {
- return this.typeOrder != null;
+ return typeOrder != null;
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASSerializer.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASSerializer.java
index d54ecb595..15b562c6d 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASSerializer.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASSerializer.java
@@ -166,7 +166,7 @@ public class CASSerializer implements Serializable {
// the
// cas
bcsd.scanAllFSsForBinarySerialization(null, csds); // no mark
- this.fsIndex = bcsd.getIndexedFSs(csds.fs2addr); // must follow scanAll...
+ fsIndex = bcsd.getIndexedFSs(csds.fs2addr); // must follow scanAll...
if (addMetaData) {
// some details about current main-heap specifications
@@ -175,7 +175,7 @@ public class CASSerializer implements Serializable {
// is 7 words long
// not serialized by custom serializers, only by Java object serialization
int heapsz = bcsd.heap.getCellsUsed();
- this.heapMetaData = new int[] { Heap.getRoundedSize(heapsz), // a bit more than the size of
+ heapMetaData = new int[] { Heap.getRoundedSize(heapsz), // a bit more than the size of
// the used heap
heapsz, // the position of the next (unused) slot in the heap
heapsz, 0, 0, 1024, // initial size
@@ -307,7 +307,7 @@ public class CASSerializer implements Serializable {
DataOutputStream dos = new DataOutputStream(ostream);
// get the indexed FSs for all views
- this.fsIndex = bcsd.getIndexedFSs(csds.fs2addr);
+ fsIndex = bcsd.getIndexedFSs(csds.fs2addr);
// output the key and version number
CommonSerDes.createHeader().seqVer(2) // 0 original, 1 UIMA-4743 2 for uima v3
@@ -384,9 +384,9 @@ public class CASSerializer implements Serializable {
// }
// output the index FSs
- dos.writeInt(this.fsIndex.length);
- for (int i = 0; i < this.fsIndex.length; i++) {
- dos.writeInt(this.fsIndex[i]);
+ dos.writeInt(fsIndex.length);
+ for (int i = 0; i < fsIndex.length; i++) {
+ dos.writeInt(fsIndex[i]);
}
// 8bit heap
@@ -511,7 +511,7 @@ public class CASSerializer implements Serializable {
break;
}
if (fs instanceof CommonArrayFS) {
- CommonArrayFS ca = (CommonArrayFS) fs;
+ CommonArrayFS<?> ca = (CommonArrayFS<?>) fs;
SlotKind kind = fs._getTypeImpl().getComponentSlotKind();
switch (kind) {
case Slot_BooleanRef:
@@ -542,7 +542,7 @@ public class CASSerializer implements Serializable {
DataOutputStream dos = new DataOutputStream(ostream);
// get the indexed FSs
- this.fsIndex = bcsd.getDeltaIndexedFSs(mark, csds.fs2addr);
+ fsIndex = bcsd.getDeltaIndexedFSs(mark, csds.fs2addr);
CommonSerDes.createHeader().delta().seqVer(2) // 1 for UIMA-4743 2 for uima v3
.v3().write(dos);
@@ -591,9 +591,9 @@ public class CASSerializer implements Serializable {
}
// output the index FSs
- dos.writeInt(this.fsIndex.length);
- for (int i = 0; i < this.fsIndex.length; i++) {
- dos.writeInt(this.fsIndex[i]);
+ dos.writeInt(fsIndex.length);
+ for (int i = 0; i < fsIndex.length; i++) {
+ dos.writeInt(fsIndex[i]);
}
// 8bit heap new
@@ -688,24 +688,19 @@ public class CASSerializer implements Serializable {
/**
* Scan the v3 fsChange info and produce v2 style info into chgXxxAddr, chgXxxValue
*
- * A prescan approach is needed in order to write the number of modifications preceding the write
+ * A pre-scan approach is needed in order to write the number of modifications preceding the write
* of the values (which unfortunately were written to the same stream in V2).
*
* @param bcsd
* holds the model needed for v2 aux arrays
- * @param cas
- * the cas to use for the delta serialization
- * @param chgMainHeapAddr
+ * @param chgMainAvs
* an ordered collection of changed addresses as an array for the main heap
- * @param chgByteAddr
+ * @param chgByteAvs
* an ordered collection of changed addresses as an array for the aux byte heap
- * @param chgShortAddr
+ * @param chgShortAvs
* an ordered collection of changed addresses as an array for the aus short heap
- * @param chgLongAddr
+ * @param chgLongAvs
* an ordered collection of changed addresses as an array for the aux long heap
- *
- * @param chgMainHeapValue
- * corresponding values
*/
static void scanModifications(BinaryCasSerDes bcsd, CommonSerDesSequential csds,
FsChange[] fssModified, Obj2IntIdentityHashMap<TOP> fs2auxOffset,
@@ -791,7 +786,7 @@ public class CASSerializer implements Serializable {
case Slot_HeapRef:
fsChange.arrayUpdates.forAllInts(index -> {
- TOP tgtFs = (TOP) ((FSArray) fs).get(index);
+ TOP tgtFs = (TOP) ((FSArray<?>) fs).get(index);
chgMainAvs.add(new AddrPlusValue(convertArrayIndexToMainHeapAddr(index, fs, fs2addr),
fs2addr.get(tgtFs)));
});
@@ -888,38 +883,38 @@ public class CASSerializer implements Serializable {
// }
int[] getHeapMetadata() {
- return this.heapMetaData;
+ return heapMetaData;
}
int[] getHeapArray() {
- return this.heapArray;
+ return heapArray;
}
String[] getStringTable() {
- return this.stringTable;
+ return stringTable;
}
int[] getFSIndex() {
- return this.fsIndex;
+ return fsIndex;
}
byte[] getByteArray() {
- return this.byteHeapArray;
+ return byteHeapArray;
}
short[] getShortArray() {
- return this.shortHeapArray;
+ return shortHeapArray;
}
long[] getLongArray() {
- return this.longHeapArray;
+ return longHeapArray;
}
private void copyHeapsToArrays(BinaryCasSerDes bcsd) {
- this.heapArray = bcsd.heap.toArray();
- this.byteHeapArray = bcsd.byteHeap.toArray();
- this.shortHeapArray = bcsd.shortHeap.toArray();
- this.longHeapArray = bcsd.longHeap.toArray();
- this.stringTable = bcsd.stringHeap.toArray();
+ heapArray = bcsd.heap.toArray();
+ byteHeapArray = bcsd.byteHeap.toArray();
+ shortHeapArray = bcsd.shortHeap.toArray();
+ longHeapArray = bcsd.longHeap.toArray();
+ stringTable = bcsd.stringHeap.toArray();
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java
index 2b1d41e61..0de8df5a9 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java
@@ -334,10 +334,7 @@ public class CasCompare {
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
ScsKey other = (ScsKey) obj;
@@ -1476,11 +1473,7 @@ public class CasCompare {
private int compareFeature(TOP fs1, TOP fs2, TypeImpl ti1, FeatureImpl fi1) {
int r = 0;
if (inSortContext && isTypeMapping) {
- if (isSrcCas && typeMapper.getTgtFeature(ti1, fi1) == null) {
- return 0; // skip tests for features not in target type system
- // so when comparing CASs, the src value won't cause a miscompare
- }
- if (!isSrcCas && typeMapper.getSrcFeature(ti1, fi1) == null) {
+ if ((isSrcCas && typeMapper.getTgtFeature(ti1, fi1) == null) || (!isSrcCas && typeMapper.getSrcFeature(ti1, fi1) == null)) {
return 0; // types/features belong to target in this case
}
}
@@ -1516,14 +1509,9 @@ public class CasCompare {
if (isTypeMapping) {
- if (isSrcCas && typeMapper.getTgtFeature(ti, fi) == null) {
- continue; // skip for features not in target type system
- // so when comparing CASs, the src value won't cause a miscompare
- }
-
// probably not executed, since types discovered on first sort
// except for a type that exists only the the target
- if (!isSrcCas && typeMapper.getSrcFeature(ti, fi) == null) {
+ if ((isSrcCas && typeMapper.getTgtFeature(ti, fi) == null) || (!isSrcCas && typeMapper.getSrcFeature(ti, fi) == null)) {
continue; // types/features belong to target in this case
}
@@ -1932,13 +1920,7 @@ public class CasCompare {
private int compareRefResult(TOP rfs1, TOP rfs2) {
// exception: treat canonical empty lists
- if (!inSortContext && IS_CANONICAL_EMPTY_LISTS && rfs1 instanceof EmptyList) {
- // if (prev1.size() <= 0 || prev2.size() <= 0) {
- return 0;
- // }
- }
-
- if (prev1.size() <= 0) {
+ if ((!inSortContext && IS_CANONICAL_EMPTY_LISTS && rfs1 instanceof EmptyList) || (prev1.size() <= 0)) {
return 0; // no recursion case
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java
index a1e38a251..ff30a9890 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSeqAddrMaps.java
@@ -72,15 +72,15 @@ public class CasSeqAddrMaps {
public CasSeqAddrMaps() {
// this call makes the first real seq number == 1.
// seq 0 refers to the NULL fs value.
- this.tgtId2SrcFs = new ArrayList<>();
- this.srcId2TgtId = new Int2IntRBT();
+ tgtId2SrcFs = new ArrayList<>();
+ srcId2TgtId = new Int2IntRBT();
addItemId(null, 0, true);
}
// copy constructor
public CasSeqAddrMaps(List<TOP> tgtSeq2SrcFs, Int2IntRBT srcAddr2TgtSeq) {
- this.tgtId2SrcFs = tgtSeq2SrcFs;
- this.srcId2TgtId = srcAddr2TgtSeq;
+ tgtId2SrcFs = tgtSeq2SrcFs;
+ srcId2TgtId = srcAddr2TgtSeq;
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java
index ba685fa55..453506b72 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java
@@ -195,7 +195,7 @@ public class CasSerializerSupport {
* @return the original instance, possibly updated
*/
public CasSerializerSupport setPrettyPrint(boolean pp) {
- this.isFormattedOutput = pp;
+ isFormattedOutput = pp;
return this;
}
@@ -208,7 +208,7 @@ public class CasSerializerSupport {
* @return the original instance, possibly updated
*/
public CasSerializerSupport setFilterTypes(TypeSystemImpl ts) {
- this.filterTypeSystem = ts;
+ filterTypeSystem = ts;
return this;
}
@@ -237,7 +237,7 @@ public class CasSerializerSupport {
* @return the original instance, possibly updated
*/
public CasSerializerSupport setErrorHandler(ErrorHandler eh) {
- this.errorHandler = eh;
+ errorHandler = eh;
return this;
}
@@ -478,10 +478,10 @@ public class CasSerializerSupport {
this.sharedData = sharedData;
// copy outer class values into final inner ones, to keep the outer thread-safe
- filterTypeSystem_inner = CasSerializerSupport.this.filterTypeSystem;
- isFormattedOutput_inner = CasSerializerSupport.this.isFormattedOutput;
+ filterTypeSystem_inner = filterTypeSystem;
+ isFormattedOutput_inner = isFormattedOutput;
this.marker = marker;
- errorHandler2 = CasSerializerSupport.this.errorHandler;
+ errorHandler2 = errorHandler;
tsi = cas.getTypeSystemImpl();
queue = new ArrayDeque<>();
@@ -505,8 +505,8 @@ public class CasSerializerSupport {
+ " multiple references. These will be serialized in duplicate.",
fi.getName());
Misc.decreasingWithTrace(errorCount, message, logger);
- if (this.errorHandler2 != null) {
- this.errorHandler2.warning(new SAXParseException(message, null));
+ if (errorHandler2 != null) {
+ errorHandler2.warning(new SAXParseException(message, null));
}
}
@@ -594,7 +594,7 @@ public class CasSerializerSupport {
Collection<TOP> fss = loopIR.getIndexedFSs();
csss.writeView(sofa, fss);
} else { // is Delta Cas
- if (sofaNum != 1 && this.marker.isNew(sofa)) {
+ if (sofaNum != 1 && marker.isNew(sofa)) {
// for views created after mark (initial view never is - it is always created with the
// CAS)
// write out the view as new
@@ -673,7 +673,7 @@ public class CasSerializerSupport {
if (sharedData == null) {
return;
}
- TOP[] fss = this.sharedData.getAndSortByIdAllFSsInIdMap();
+ TOP[] fss = sharedData.getAndSortByIdAllFSsInIdMap();
previouslySerializedFSs = new ArrayList<>();
for (TOP fs : fss) {
@@ -863,10 +863,6 @@ public class CasSerializerSupport {
* This call is recursive with enqueueFeatures, \ and an arbitrary long chain can get stack
* overflow error. Probably should fix this someday. See
* https://issues.apache.org/jira/browse/UIMA-106
- *
- * @param addr
- * The FS address.
- * @throws SAXException
*/
private void enqueueFsAndMaybeFeatures(TOP fs) throws SAXException {
if (null == fs) {
@@ -898,8 +894,6 @@ public class CasSerializerSupport {
* noting if they've already been added
* -- this indicates either a loop or another ref from outside,
* -- in either case, return true - t
- * @param curNode -
- * @param featCode -
* @return false if no list element is multiply-referenced,
* true if there is a loop or another ref from outside the list, for
* one or more list element nodes
@@ -994,13 +988,6 @@ public class CasSerializerSupport {
/**
* Enqueue all FSs reachable from features of the given FS.
- *
- * @param addr
- * address of an FS
- * @param typeCode
- * type of the FS
- * @param insideListNode
- * true iff the enclosing FS (addr) is a list type
*/
private void enqueueFeatures(TOP fs) throws SAXException {
@@ -1008,7 +995,6 @@ public class CasSerializerSupport {
* Handle FSArrays
*/
if (fs instanceof FSArray) {
-
TOP[] theArray = ((FSArray) fs)._getTheArray();
for (TOP elem : theArray) {
@@ -1028,6 +1014,7 @@ public class CasSerializerSupport {
if (fs instanceof UimaSerializable) {
((UimaSerializable) fs)._save_to_cas_data();
}
+
for (FeatureImpl fi : fs._getTypeImpl().getFeatureImpls()) {
if (isFiltering && filterTypeSystem_inner.getFeatureByFullName(fi.getName()) == null) {
// skip features that aren't in the target type system
@@ -1127,7 +1114,7 @@ public class CasSerializerSupport {
}
} else if (startOfList_node instanceof FSList && !alreadyVisited) {
// also, we need to enqueue any FSs reachable from an FSList
- enqueueFSListElements((FSList) startOfList_node);
+ enqueueFSListElements((FSList<?>) startOfList_node);
}
break;
}
@@ -1137,11 +1124,8 @@ public class CasSerializerSupport {
/**
* Enqueues all FS reachable from an FSArray.
- *
- * @param addr
- * Address of an FSArray
*/
- private void enqueueFSArrayElements(FSArray fsArray) throws SAXException {
+ private <T extends TOP> void enqueueFSArrayElements(FSArray<T> fsArray) throws SAXException {
for (TOP elem : fsArray._getTheArray()) {
if (elem != null) {
enqueueFsAndMaybeFeatures(elem);
@@ -1152,11 +1136,8 @@ public class CasSerializerSupport {
/**
* Enqueues all Head values of FSList reachable from an FSList. This does NOT include the list
* nodes themselves.
- *
- * @param addr
- * Address of an FSList
*/
- private void enqueueFSListElements(FSList<TOP> node) throws SAXException {
+ private <T extends TOP> void enqueueFSListElements(FSList<T> node) throws SAXException {
node.walkList_saxException(
n -> enqueueFsAndMaybeFeatures(((NonEmptyFSList<TOP>) n).getHead()), null);
}
@@ -1356,10 +1337,7 @@ public class CasSerializerSupport {
}
public int getXmiIdAsInt(TOP fs) {
- if (fs == null) {
- return 0;
- }
- if (isFiltering && null == filterTypeSystem_inner.getType(fs._getTypeImpl().getName())) { // return
+ if ((fs == null) || (isFiltering && null == filterTypeSystem_inner.getType(fs._getTypeImpl().getName()))) { // return
// as
// null
// any
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java
index 58699c5f8..17a2c363b 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasTypeSystemMapper.java
@@ -92,7 +92,7 @@ public class CasTypeSystemMapper {
final private boolean typeSystemsSame;
public boolean isEqual() {
- return this.typeSystemsSame;
+ return typeSystemsSame;
}
public CasTypeSystemMapper(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt) {
@@ -121,7 +121,7 @@ public class CasTypeSystemMapper {
fSrc2Tgt = null;
fTgt2Src = null;
}
- this.typeSystemsSame = tss;
+ typeSystemsSame = tss;
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonAuxHeap.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonAuxHeap.java
index bf70ade84..52b5bbc55 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonAuxHeap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonAuxHeap.java
@@ -110,12 +110,12 @@ abstract class CommonAuxHeap {
initMemory(newSize);
}
}
- this.heapPos = FIRST_CELL_REF;
+ heapPos = FIRST_CELL_REF;
}
int reserve(int numCells) {
- int cellRef = this.heapPos;
- this.heapPos += numCells;
+ int cellRef = heapPos;
+ heapPos += numCells;
growHeapIfNeeded();
return cellRef;
}
@@ -193,7 +193,7 @@ abstract class CommonAuxHeap {
}
int getSize() {
- return this.heapPos;
+ return heapPos;
}
abstract int getCapacity();
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java
index 38c1911a0..10300fc32 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java
@@ -102,7 +102,7 @@ public class CommonSerDesSequential {
private int heapEnd; // == the last addr + length of that
public CommonSerDesSequential(CASImpl cas) {
- this.baseCas = cas.getBaseCAS();
+ baseCas = cas.getBaseCAS();
}
public boolean isEmpty() {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConjunctiveConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConjunctiveConstraint.java
index d75fbe2cd..43632418d 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConjunctiveConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConjunctiveConstraint.java
@@ -55,12 +55,12 @@ class ConjunctiveConstraint implements FSMatchConstraint {
@Override
public boolean match(FeatureStructure fs) {
- return (this.c1.match(fs) && this.c2.match(fs));
+ return (c1.match(fs) && c2.match(fs));
}
@Override
public String toString() {
- return "(" + this.c1.toString() + " & " + this.c2.toString() + ")";
+ return "(" + c1.toString() + " & " + c2.toString() + ")";
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/DisjunctiveConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/DisjunctiveConstraint.java
index 79a541948..91a38c35e 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/DisjunctiveConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/DisjunctiveConstraint.java
@@ -50,12 +50,12 @@ class DisjunctiveConstraint implements FSMatchConstraint {
@Override
public boolean match(FeatureStructure fs) {
- return (this.c1.match(fs) || this.c2.match(fs));
+ return (c1.match(fs) || c2.match(fs));
}
@Override
public String toString() {
- return "(" + this.c1.toString() + " | " + this.c2.toString() + ")";
+ return "(" + c1.toString() + " | " + c2.toString() + ")";
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java
index 49e3cb355..38bdf3a0a 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java
@@ -46,24 +46,24 @@ class EmbeddedConstraint extends PathConstraint implements FSMatchConstraint {
@Override
public boolean match(FeatureStructure fs) {
// compile(((FeatureStructureImpl) fs).getCAS().getTypeSystem());
- final int max = this.featNames.size();
+ final int max = featNames.size();
for (int i = 0; i < max; i++) {
if (fs == null) {
// for now it will throw null pointer exception on next line.
// This is the same behavior as V2
}
- Feature feat = fs.getType().getFeatureByBaseName(this.featNames.get(i));
+ Feature feat = fs.getType().getFeatureByBaseName(featNames.get(i));
if (feat == null) {
return false;
}
fs = fs.getFeatureValue(feat); // could be null
}
- return this.cons.match(fs);
+ return cons.match(fs);
}
@Override
public String toString() {
- return super.toString() + ".( " + this.cons.toString() + " )";
+ return super.toString() + ".( " + cons.toString() + " )";
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSBooleanConstraintImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSBooleanConstraintImpl.java
index d0c0484a1..710449ffb 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSBooleanConstraintImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSBooleanConstraintImpl.java
@@ -41,7 +41,7 @@ public class FSBooleanConstraintImpl implements FSBooleanConstraint {
*/
@Override
public void eq(boolean cond) {
- this.condition = cond;
+ condition = cond;
}
/*
@@ -51,7 +51,7 @@ public class FSBooleanConstraintImpl implements FSBooleanConstraint {
*/
@Override
public boolean match(boolean cond) {
- return (this.condition == cond);
+ return (condition == cond);
}
@Override
@@ -59,7 +59,7 @@ public class FSBooleanConstraintImpl implements FSBooleanConstraint {
// need to escape quotes and backslashes
StringBuffer buf = new StringBuffer();
buf.append("= \"");
- buf.append(this.condition);
+ buf.append(condition);
buf.append('"');
return buf.toString();
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
index 4b777674e..50246d6a2 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
@@ -265,7 +265,7 @@ public abstract class FSClassRegistry { // abstract to prevent instantiating; th
this.generator = generator;
this.jcasClass = jcasClass;
this.jcasType = jcasType; // typeId for jcas class, **NOT Typecode**
- this.features = getJCasClassFeatureInfo(jcasClass);
+ features = getJCasClassFeatureInfo(jcasClass);
// System.out.println("debug create jcci, class = " + jcasClass.getName() + ", typeint = " +
// jcasType);
@@ -1354,10 +1354,7 @@ public abstract class FSClassRegistry { // abstract to prevent instantiating; th
Parameter[] p = m.getParameters();
TypeImpl range = fi.getRangeImpl();
- if (p.length > 1) {
- continue; // not a getter, which has either 0 or 1 arg(the index int for arrays)
- }
- if (p.length == 1 && (!range.isArray() || p[0].getType() != int.class)) {
+ if ((p.length > 1) || (p.length == 1 && (!range.isArray() || p[0].getType() != int.class))) {
continue; // has 1 arg, but is not an array or the arg is not an int
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java
index 8f274466c..5e59f1632 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java
@@ -49,41 +49,41 @@ class FSFloatConstraintImpl implements FSFloatConstraint {
private Vector<Float> values;
FSFloatConstraintImpl() {
- this.codes = new IntVector();
- this.values = new Vector<>();
+ codes = new IntVector();
+ values = new Vector<>();
}
@Override
public boolean match(float f) {
- final int max = this.codes.size();
+ final int max = codes.size();
for (int i = 0; i < max; i++) {
- switch (this.codes.get(i)) {
+ switch (codes.get(i)) {
case LT: {
- if (f >= this.values.get(i)) {
+ if (f >= values.get(i)) {
return false;
}
break;
}
case LEQ: {
- if (f > this.values.get(i)) {
+ if (f > values.get(i)) {
return false;
}
break;
}
case EQ: {
- if (f != this.values.get(i)) {
+ if (f != values.get(i)) {
return false;
}
break;
}
case GEQ: {
- if (f < this.values.get(i)) {
+ if (f < values.get(i)) {
return false;
}
break;
}
case GT: {
- if (f <= this.values.get(i)) {
+ if (f <= values.get(i)) {
return false;
}
break;
@@ -105,8 +105,8 @@ class FSFloatConstraintImpl implements FSFloatConstraint {
*/
@Override
public void eq(float f) {
- this.codes.add(EQ);
- this.values.add(f);
+ codes.add(EQ);
+ values.add(f);
}
/**
@@ -117,8 +117,8 @@ class FSFloatConstraintImpl implements FSFloatConstraint {
*/
@Override
public void lt(float f) {
- this.codes.add(LT);
- this.values.add(f);
+ codes.add(LT);
+ values.add(f);
}
/**
@@ -129,8 +129,8 @@ class FSFloatConstraintImpl implements FSFloatConstraint {
*/
@Override
public void leq(float f) {
- this.codes.add(LEQ);
- this.values.add(f);
+ codes.add(LEQ);
+ values.add(f);
}
/**
@@ -141,8 +141,8 @@ class FSFloatConstraintImpl implements FSFloatConstraint {
*/
@Override
public void gt(float f) {
- this.codes.add(GT);
- this.values.add(f);
+ codes.add(GT);
+ values.add(f);
}
/**
@@ -153,21 +153,21 @@ class FSFloatConstraintImpl implements FSFloatConstraint {
*/
@Override
public void geq(float f) {
- this.codes.add(GEQ);
- this.values.add(f);
+ codes.add(GEQ);
+ values.add(f);
}
@Override
public String toString() {
- if (this.codes.size() == 1) {
- return toString(this.codes.get(0)) + " " + this.values.get(0).toString();
+ if (codes.size() == 1) {
+ return toString(codes.get(0)) + " " + values.get(0).toString();
}
StringBuffer buf = new StringBuffer();
buf.append("( ");
- for (int i = 0; i < this.codes.size(); i++) {
- buf.append(toString(this.codes.get(i)));
+ for (int i = 0; i < codes.size(); i++) {
+ buf.append(toString(codes.get(i)));
buf.append(' ');
- buf.append(this.values.get(i).toString());
+ buf.append(values.get(i).toString());
buf.append(' ');
}
buf.append(')');
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java
index 270a49216..9d28ae9f4 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexComparatorImpl.java
@@ -50,9 +50,9 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
// Public only for testing purposes.
public FSIndexComparatorImpl() {
- this.type = null;
- this.keySpecs = new ArrayList<>();
- this.directions = new IntVector();
+ type = null;
+ keySpecs = new ArrayList<>();
+ directions = new IntVector();
}
private FSIndexComparatorImpl(Type type, List<Object> keySpecs, IntVector directions) {
@@ -72,11 +72,11 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
@Override
public Type getType() {
- return this.type;
+ return type;
}
int getTypeCode() {
- return ((TypeImpl) this.type).getCode();
+ return ((TypeImpl) type).getCode();
}
@Override
@@ -84,48 +84,48 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
if (!checkType(feat.getRange())) {
return -1;
}
- final int rc = this.keySpecs.size();
- this.keySpecs.add(feat);
- this.directions.add(compareKey);
+ final int rc = keySpecs.size();
+ keySpecs.add(feat);
+ directions.add(compareKey);
return rc;
}
@Override
public int addKey(LinearTypeOrder typeOrder, int compareKey) {
- final int rc = this.keySpecs.size();
- this.keySpecs.add(typeOrder);
- this.directions.add(compareKey);
+ final int rc = keySpecs.size();
+ keySpecs.add(typeOrder);
+ directions.add(compareKey);
return rc;
}
@Override
public int getKeyType(int key) {
- return (this.keySpecs.get(key) instanceof Feature) ? FEATURE_KEY : TYPE_ORDER_KEY;
+ return (keySpecs.get(key) instanceof Feature) ? FEATURE_KEY : TYPE_ORDER_KEY;
}
@Override
public int getNumberOfKeys() {
- return this.keySpecs.size();
+ return keySpecs.size();
}
@Override
public FeatureImpl getKeyFeature(int key) {
if (getKeyType(key) == FEATURE_KEY) {
- return (FeatureImpl) this.keySpecs.get(key);
+ return (FeatureImpl) keySpecs.get(key);
}
return null;
}
public LinearTypeOrder getKeyTypeOrder(int key) {
if (getKeyType(key) == TYPE_ORDER_KEY) {
- return (LinearTypeOrder) this.keySpecs.get(key);
+ return (LinearTypeOrder) keySpecs.get(key);
}
return null;
}
@Override
public int getKeyComparator(int key) {
- return this.directions.get(key);
+ return directions.get(key);
}
/**
@@ -140,7 +140,7 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
return false;
}
FSIndexComparatorImpl comp = (FSIndexComparatorImpl) o;
- if (this.type != comp.type) {
+ if (type != comp.type) {
return false;
}
return equalsWithoutType(comp);
@@ -154,12 +154,12 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
* @return true if they're the same comparator
*/
boolean equalsWithoutType(FSIndexComparatorImpl comp) {
- final int max = this.getNumberOfKeys();
+ final int max = getNumberOfKeys();
if (max != comp.getNumberOfKeys()) {
return false;
}
for (int i = 0; i < max; i++) {
- Object keySpec1 = this.keySpecs.get(i);
+ Object keySpec1 = keySpecs.get(i);
Object keySpec2 = comp.keySpecs.get(i);
if (keySpec1 instanceof LinearTypeOrder) {
// equals compares the type codes in the ordered arrays for ==
@@ -177,7 +177,7 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
// also need to confirm offsets are the same
&& f1.getOffset() == f2.getOffset()
&& f1.getAdjustedOffset() == f2.getAdjustedOffset()
- && this.directions.get(i) == comp.directions.get(i);
+ && directions.get(i) == comp.directions.get(i);
if (!featimpl_match) {
return false;
@@ -191,10 +191,10 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((this.type == null) ? 31 : type.hashCode());
- final int max = this.getNumberOfKeys();
+ result = prime * result + ((type == null) ? 31 : type.hashCode());
+ final int max = getNumberOfKeys();
for (int i = 0; i < max; i++) {
- Object o = this.keySpecs.get(i); // LinearTypeOrder or feature
+ Object o = keySpecs.get(i); // LinearTypeOrder or feature
if (o instanceof LinearTypeOrder) {
result = prime * result + ((LinearTypeOrderBuilderImpl.TotalTypeOrder) o).hashCode();
} else {
@@ -205,7 +205,7 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
// range type name
result = prime * result + f.getOffset();
result = prime * result + f.getAdjustedOffset();
- result = prime * result + this.directions.get(i);
+ result = prime * result + directions.get(i);
}
}
return result;
@@ -213,20 +213,20 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
@Override
public boolean isValid() {
- if (this.type == null) {
+ if (type == null) {
return false;
}
- final int max = this.getNumberOfKeys();
+ final int max = getNumberOfKeys();
Feature feat;
for (int i = 0; i < max; i++) {
if (getKeyType(i) != FEATURE_KEY) {
continue;
}
- feat = (Feature) this.keySpecs.get(i);
+ feat = (Feature) keySpecs.get(i);
// if (feat.getTypeSystem() != ts) {
// return false;
// }
- if (!((TypeImpl) feat.getDomain()).subsumes((TypeImpl) this.type)) {
+ if (!((TypeImpl) feat.getDomain()).subsumes((TypeImpl) type)) {
return false;
}
}
@@ -247,21 +247,21 @@ public class FSIndexComparatorImpl implements FSIndexComparator {
@Override
public int compareTo(FSIndexComparator o) {
FSIndexComparator comp = o;
- final int thisSize = this.getNumberOfKeys();
+ final int thisSize = getNumberOfKeys();
final int compSize = comp.getNumberOfKeys();
int i = 0;
int feat1, feat2;
while ((i < thisSize) && (i < compSize)) {
- feat1 = this.getKeyFeature(i).getCode();
+ feat1 = getKeyFeature(i).getCode();
feat2 = ((FeatureImpl) comp.getKeyFeature(i)).getCode();
if (feat1 < feat2) {
return -1;
} else if (feat1 > feat2) {
return 1;
} else {
- if (this.getKeyComparator(i) < comp.getKeyComparator(i)) {
+ if (getKeyComparator(i) < comp.getKeyComparator(i)) {
return -1;
- } else if (this.getKeyComparator(i) > comp.getKeyComparator(i)) {
+ } else if (getKeyComparator(i) > comp.getKeyComparator(i)) {
return 1;
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
index dda4dfd82..37538c695 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
@@ -194,7 +194,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
private boolean isSetUpFromBaseCAS = false;
SharedIndexInfo(TypeSystemImpl typeSystem) {
- this.tsi = typeSystem;
+ tsi = typeSystem;
}
}
@@ -228,7 +228,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
final ArrayList<FsIndex_iicp<TOP>> indexesForType = new ArrayList<>(0);
IndexesForType(TypeImpl ti) {
- this.typename = ti.getName();
+ typename = ti.getName();
}
<T extends TOP> FsIndex_iicp<T> getNonSetIndex() {
@@ -329,7 +329,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
IndexesForType getIndexesForUsedType(int i) {
- return indexArray[this.usedIndexes.get(i)];
+ return indexArray[usedIndexes.get(i)];
}
// moved from here into individual indexes over each type, for better locality of reference
@@ -431,16 +431,16 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
@SuppressWarnings("unused")
private FSIndexRepositoryImpl() {
- this.cas = null; // because it's final
- this.sii = null;
- this.name2indexMap = null;
- this.indexArray = null;
+ cas = null; // because it's final
+ sii = null;
+ name2indexMap = null;
+ indexArray = null;
// this.detectIllegalIndexUpdates = null;
// this.flattenedIndexValid = null;
- this.indexUpdates = null;
- this.indexUpdateOperation = null;
- this.usedIndexes = null;
- this.isUsed = null;
+ indexUpdates = null;
+ indexUpdateOperation = null;
+ usedIndexes = null;
+ isUsed = null;
// this.isUsedChanged = true;
// this.iicps4allFSs = null;
}
@@ -452,20 +452,20 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
*/
FSIndexRepositoryImpl(CASImpl cas) {
this.cas = cas;
- this.sii = new SharedIndexInfo(cas.getTypeSystemImpl());
+ sii = new SharedIndexInfo(cas.getTypeSystemImpl());
- final TypeSystemImpl ts = this.sii.tsi;
+ final TypeSystemImpl ts = sii.tsi;
// Type counting starts at 1.
final int numTypes = ts.getNumberOfTypes() + 1;
// this.detectIllegalIndexUpdates = new int[numTypes];
// this.flattenedIndexValid = new ConcurrentBits(numTypes);
- this.name2indexMap = new HashMap<>();
- this.indexUpdates = new ArrayList<>();
- this.indexUpdateOperation = new BitSet();
- this.logProcessed = false;
- this.indexArray = new IndexesForType[this.sii.tsi.getNumberOfTypes() + 1];
- this.usedIndexes = new IntVector();
- this.isUsed = new BitSet(numTypes);
+ name2indexMap = new HashMap<>();
+ indexUpdates = new ArrayList<>();
+ indexUpdateOperation = new BitSet();
+ logProcessed = false;
+ indexArray = new IndexesForType[sii.tsi.getNumberOfTypes() + 1];
+ usedIndexes = new IntVector();
+ isUsed = new BitSet(numTypes);
// this.isUsedChanged = true;
// this.iicps4allFSs = new ArrayList<>();
init();
@@ -480,22 +480,22 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
FSIndexRepositoryImpl(CASImpl cas, FSIndexRepositoryImpl baseIndexRepo) {
this.cas = cas;
- this.sii = baseIndexRepo.sii;
+ sii = baseIndexRepo.sii;
sii.isSetUpFromBaseCAS = true; // bypasses initialization already done
- final TypeSystemImpl ts = this.sii.tsi;
+ final TypeSystemImpl ts = sii.tsi;
// Type counting starts at 1.
final int numTypes = ts.getNumberOfTypes() + 1;
// this.detectIllegalIndexUpdates = new int[numTypes];
// this.flattenedIndexValid = new ConcurrentBits(numTypes);
- this.name2indexMap = new HashMap<>();
- this.indexUpdates = new ArrayList<>();
- this.indexUpdateOperation = new BitSet();
- this.logProcessed = false;
- this.indexArray = new IndexesForType[numTypes];
- this.usedIndexes = new IntVector();
- this.isUsed = new BitSet(numTypes);
+ name2indexMap = new HashMap<>();
+ indexUpdates = new ArrayList<>();
+ indexUpdateOperation = new BitSet();
+ logProcessed = false;
+ indexArray = new IndexesForType[numTypes];
+ usedIndexes = new IntVector();
+ isUsed = new BitSet(numTypes);
// this.isUsedChanged = true;
// this.iicps4allFSs = new ArrayList<>();
init();
@@ -509,7 +509,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
* Initialize data. Common initialization called from the constructors.
*/
private void init() {
- final TypeSystemImpl ts = this.sii.tsi;
+ final TypeSystemImpl ts = sii.tsi;
// **********************************************
// for each type in the TypeSystem,
@@ -519,7 +519,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
final int numTypes = ts.getNumberOfTypes() + 1; // Type counting starts at 1.
// Can't instantiate arrays of generic types, but this is ok for ArrayList.
for (int i = 1; i < numTypes; i++) {
- this.indexArray[i] = new IndexesForType(ts.types.get(i));
+ indexArray[i] = new IndexesForType(ts.types.get(i));
}
// Arrays.fill(detectIllegalIndexUpdates, Integer.MIN_VALUE);
@@ -552,7 +552,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
@Override
public boolean createIndex(FSIndexComparator comp, String label, int indexType)
throws CASAdminException {
- if (this.locked) {
+ if (locked) {
throw new CASAdminException(CASAdminException.REPOSITORY_LOCKED);
}
return createIndexNoQuestionsAsked(comp, label, indexType);
@@ -575,11 +575,11 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
public <T extends FeatureStructure> boolean createIndexNoQuestionsAsked(
final FSIndexComparator comp, String label, int indexType) {
- FsIndex_iicp<TOP> cp = this.name2indexMap.get(label);
+ FsIndex_iicp<TOP> cp = name2indexMap.get(label);
if (cp == null) {
// Create new index
- cp = this.addNewIndexRecursive(comp, indexType);
+ cp = addNewIndexRecursive(comp, indexType);
// create a set of feature codes that are in one or more index definitions,
// only once for all cas views
@@ -592,7 +592,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
}
- this.name2indexMap.put(label, cp);
+ name2indexMap.put(label, cp);
return true;
}
@@ -636,7 +636,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
*/
//@formatter:on
public void removeIndex(String label) {
- FsIndex_iicp<TOP> cp = this.name2indexMap.get(label);
+ FsIndex_iicp<TOP> cp = name2indexMap.get(label);
if (cp == null) {
return;
}
@@ -658,15 +658,11 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
* Reset all indexes, in one view.
*/
public void flush() {
- if (!this.locked) {
- return;
- }
-
// if (DEBUG) {
// System.out.println("Index Flush Top");
// }
// Do nothing really fast!
- if (this.usedIndexes.size() == 0) {
+ if (!locked || (usedIndexes.size() == 0)) {
return;
}
@@ -675,7 +671,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
// isUsedChanged = true;
// iicps4allFSs.clear();
for (int i = 0; i < usedIndexes.size(); i++) {
- int used = this.usedIndexes.get(i);
+ int used = usedIndexes.get(i);
for (FsIndex_iicp<?> iicp : indexArray[used].indexesForType) {
iicp.fsIndex_singletype.flush();
}
@@ -686,14 +682,14 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
// reset the index update trackers
// resetDetectIllegalIndexUpdates();
- this.indexUpdates.clear();
- this.indexUpdateOperation.clear();
+ indexUpdates.clear();
+ indexUpdateOperation.clear();
mPii = new ProcessedIndexInfo();
// this.fsAddedToIndex = new IntSet();
// this.fsDeletedFromIndex = new IntSet();
// this.fsReindexed = new PositiveIntSet_impl();
- this.logProcessed = false;
- this.usedIndexes.removeAllElements();
+ logProcessed = false;
+ usedIndexes.removeAllElements();
}
// // for now, with flattened index optimization disabled, this should be a no-op
@@ -785,7 +781,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
switch (indexingStrategy) {
case FSIndex.SET_INDEX:
- ind = new FsIndex_set_sorted<>(this.cas, type, indexingStrategy, comparatorForIndexSpecs); // false
+ ind = new FsIndex_set_sorted<>(cas, type, indexingStrategy, comparatorForIndexSpecs); // false
// =
// is
// set
@@ -797,14 +793,14 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
case FSIndex.BAG_INDEX:
case FSIndex.DEFAULT_BAG_INDEX:
- ind = new FsIndex_bag<>(this.cas, type, initialSize, indexingStrategy,
+ ind = new FsIndex_bag<>(cas, type, initialSize, indexingStrategy,
comparatorForIndexSpecs);
break;
default:
// SORTED_INDEX is the default. We don't throw any errors, if the code is unknown, we just
// create a sorted index.
- ind = new FsIndex_set_sorted<>(this.cas, type, FSIndex.SORTED_INDEX,
+ ind = new FsIndex_set_sorted<>(cas, type, FSIndex.SORTED_INDEX,
comparatorForIndexSpecs); // true = is sorted
break;
@@ -901,36 +897,36 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
public void commit() {
// Will create the default type order if it doesn't exist at this point.
getDefaultTypeOrder();
- this.locked = true;
+ locked = true;
}
@Override
public LinearTypeOrder getDefaultTypeOrder() {
- if (this.sii.defaultTypeOrder == null) {
- if (this.sii.defaultOrderBuilder == null) {
- this.sii.defaultOrderBuilder = new LinearTypeOrderBuilderImpl(this.sii.tsi);
+ if (sii.defaultTypeOrder == null) {
+ if (sii.defaultOrderBuilder == null) {
+ sii.defaultOrderBuilder = new LinearTypeOrderBuilderImpl(sii.tsi);
}
try {
- this.sii.defaultTypeOrder = this.sii.defaultOrderBuilder.getOrder();
+ sii.defaultTypeOrder = sii.defaultOrderBuilder.getOrder();
} catch (final CASException e) {
// Since we're doing this on an existing type names, we can't
// get here.
throw new UIMARuntimeException(UIMARuntimeException.INTERNAL_ERROR, new Object[0], e);
}
}
- return this.sii.defaultTypeOrder;
+ return sii.defaultTypeOrder;
}
@Override
public LinearTypeOrderBuilder getDefaultOrderBuilder() {
- if (this.sii.defaultOrderBuilder == null) {
- this.sii.defaultOrderBuilder = new LinearTypeOrderBuilderImpl(this.sii.tsi);
+ if (sii.defaultOrderBuilder == null) {
+ sii.defaultOrderBuilder = new LinearTypeOrderBuilderImpl(sii.tsi);
}
- return this.sii.defaultOrderBuilder;
+ return sii.defaultOrderBuilder;
}
void setDefaultTypeOrder(LinearTypeOrder order) {
- this.sii.defaultTypeOrder = order;
+ sii.defaultTypeOrder = order;
}
/**
@@ -997,7 +993,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
*/
@Override
public Iterator<String> getLabels() {
- return this.name2indexMap.keySet().iterator();
+ return name2indexMap.keySet().iterator();
}
/**
@@ -1015,7 +1011,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
String label;
while (it.hasNext()) {
label = it.next();
- if (this.name2indexMap.get(label).fsIndex_singletype.getComparatorImplForIndexSpecs()
+ if (name2indexMap.get(label).fsIndex_singletype.getComparatorImplForIndexSpecs()
.equals(comp)) {
labels.add(label);
}
@@ -1039,7 +1035,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
public <T extends FeatureStructure> FSIndex<T> getIndex(String label, Type type) {
// iicp is for the type the index was defined for
- final FsIndex_iicp<TOP> iicp = this.name2indexMap.get(label);
+ final FsIndex_iicp<TOP> iicp = name2indexMap.get(label);
if (iicp == null) {
return null;
}
@@ -1073,7 +1069,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
@Override
@SuppressWarnings("unchecked")
public <T extends FeatureStructure> LowLevelIndex<T> getIndex(String label) {
- return (LowLevelIndex<T>) this.name2indexMap.get(label);
+ return (LowLevelIndex<T>) name2indexMap.get(label);
}
/**
@@ -1104,7 +1100,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
@Override
public void removeAllIncludingSubtypes(Type type) {
removeAllExcludingSubtypes(type);
- List<Type> subtypes = this.sii.tsi.getDirectSubtypes(type);
+ List<Type> subtypes = sii.tsi.getDirectSubtypes(type);
for (Type subtype : subtypes) {
removeAllIncludingSubtypes(subtype);
}
@@ -1123,7 +1119,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
*/
@Override
public boolean isCommitted() {
- return this.locked;
+ return locked;
}
/**
@@ -1176,7 +1172,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
* the action to do on each FS
*/
public void walkIndexedFSs(Consumer<TOP> action) {
- for (int i = 0; i < this.usedIndexes.size(); i++) {
+ for (int i = 0; i < usedIndexes.size(); i++) {
for (TOP fs : getNonSetSingleIndexForUsedType(i)) {
action.accept(fs);
}
@@ -1191,7 +1187,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
*/
public void walkSortedIndexedFSs(Consumer<TOP> action) {
List<TOP> fss = new ArrayList<>();
- for (int i = 0; i < this.usedIndexes.size(); i++) {
+ for (int i = 0; i < usedIndexes.size(); i++) {
for (TOP fs : getNonSetSingleIndexForUsedType(i)) {
fss.add(fs);
}
@@ -1309,9 +1305,9 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
//@formatter:on
@Override
public LinearTypeOrderBuilder createTypeSortOrder() {
- final LinearTypeOrderBuilder orderBuilder = new LinearTypeOrderBuilderImpl(this.sii.tsi);
- if (this.sii.defaultOrderBuilder == null) {
- this.sii.defaultOrderBuilder = orderBuilder;
+ final LinearTypeOrderBuilder orderBuilder = new LinearTypeOrderBuilderImpl(sii.tsi);
+ if (sii.defaultOrderBuilder == null) {
+ sii.defaultOrderBuilder = orderBuilder;
}
return orderBuilder;
}
@@ -1323,8 +1319,8 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
@Override
public <T extends FeatureStructure> LowLevelIndex<T> ll_getIndex(String indexName, int typeCode) {
- final TypeSystemImpl tsi = this.sii.tsi;
- if (!tsi.isType(typeCode) || !this.cas.ll_isRefType(typeCode)) {
+ final TypeSystemImpl tsi = sii.tsi;
+ if (!tsi.isType(typeCode) || !cas.ll_isRefType(typeCode)) {
throw new LowLevelException(LowLevelException.INVALID_INDEX_TYPE, Integer.toString(typeCode));
}
return (LowLevelIndex<T>) getIndex(indexName, tsi.ll_getTypeForCode(typeCode));
@@ -1401,13 +1397,13 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
// remember if we get any set or sorted index by turning this true
- if (setOrSorted == false && indexingStrategy != FSIndex.BAG_INDEX) {
+ if (!setOrSorted && indexingStrategy != FSIndex.BAG_INDEX) {
setOrSorted = true;
}
}
// log even if added back, because remove logs remove, and might want to know it was "reindexed"
- if (this.cas.getCurrentMark() != null) {
+ if (cas.getCurrentMark() != null) {
logIndexOperation(fs, true);
}
@@ -1422,7 +1418,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
// https://issues.apache.org/jira/browse/UIMA-4111
if (noIndexOrOnlySetindexes) {
// lazily create a default bag index for this type
- final Type type = this.sii.tsi.ll_getTypeForCode(typeCode);
+ final Type type = sii.tsi.ll_getTypeForCode(typeCode);
final String defIndexName = getAutoIndexNameForType(type);
final FSIndexComparator comparator = createComparator(); // empty comparator
comparator.setType(type);
@@ -1433,11 +1429,11 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
((FsIndex_singletype<T>) (indexes.get(indexes.size() - 1)).fsIndex_singletype).insert(fs);
}
- if (!this.isUsed.get(typeCode)) {
+ if (!isUsed.get(typeCode)) {
// mark this type as being in some indexes
- this.isUsed.set(typeCode);
+ isUsed.set(typeCode);
// this.isUsedChanged = true;
- this.usedIndexes.add(typeCode);
+ usedIndexes.add(typeCode);
}
}
@@ -1477,10 +1473,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
//@formatter:on
if (i4t.aSortedIndex < 0) {
int bi = i4t.aBagIndex; // >= 0 if there is a bag index
- if (bi < 0 && !i4t.hasSetIndex) {
- return false; // no indexes defined for this type
- }
- if (bi >= 0 && !i4t.indexesForType.get(bi).fsIndex_singletype.contains(fs)) {
+ if ((bi < 0 && !i4t.hasSetIndex) || (bi >= 0 && !i4t.indexesForType.get(bi).fsIndex_singletype.contains(fs))) {
return false; // not in defined bag index
}
}
@@ -1504,7 +1497,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
if (wasRemoved) {
// incrementIllegalIndexUpdateDetector(typeCode);
- if (this.cas.getCurrentMark() != null) {
+ if (cas.getCurrentMark() != null) {
logIndexOperation(fs, ITEM_REMOVED_FROM_INDEX);
}
@@ -1516,7 +1509,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
// }
}
if (CASImpl.traceCow) {
- this.cas.traceIndexMod(false, fs, skipBagIndexes);
+ cas.traceIndexMod(false, fs, skipBagIndexes);
}
return wasRemoved;
}
@@ -1611,7 +1604,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
@Override
public Collection<TOP> getIndexedFSs() {
final ArrayList<CopyOnWriteIndexPart<TOP>> indexes = new ArrayList<>();
- for (int i = 0; i < this.usedIndexes.size(); i++) {
+ for (int i = 0; i < usedIndexes.size(); i++) {
FsIndex_singletype<TOP> idx = getNonSetSingleIndexForUsedType(i);
if (idx.size() > 0) {
indexes.add(idx.getNonNullCow());
@@ -1939,11 +1932,11 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
private <T extends TOP> void logIndexOperation(T fs, boolean added) {
- this.indexUpdates.add(fs);
+ indexUpdates.add(fs);
if (added) {
- this.indexUpdateOperation.set(this.indexUpdates.size() - 1, added); // operation was "add"
+ indexUpdateOperation.set(indexUpdates.size() - 1, added); // operation was "add"
}
- this.logProcessed = false;
+ logProcessed = false;
}
// Delta Serialization support
@@ -1973,10 +1966,10 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
final ProcessedIndexInfo pii = mPii;
- final int len = this.indexUpdates.size();
+ final int len = indexUpdates.size();
for (int i = 0; i < len; i++) {
- final TOP fs = this.indexUpdates.get(i);
- final boolean added = this.indexUpdateOperation.get(i);
+ final TOP fs = indexUpdates.get(i);
+ final boolean added = indexUpdateOperation.get(i);
if (added) {
boolean wasRemoved = pii.fsDeletedFromIndex.remove(fs);
if (wasRemoved) {
@@ -1995,13 +1988,13 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
}
}
- this.logProcessed = true;
- this.indexUpdates.clear();
- this.indexUpdateOperation.clear();
+ logProcessed = true;
+ indexUpdates.clear();
+ indexUpdateOperation.clear();
}
public Set<TOP> getUpdatedFSs(Set<TOP> items) {
- if (!this.logProcessed) {
+ if (!logProcessed) {
processIndexUpdates();
}
return items;
@@ -2020,7 +2013,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
public boolean isModified() {
- if (!this.logProcessed) {
+ if (!logProcessed) {
processIndexUpdates();
}
final ProcessedIndexInfo pii = mPii;
@@ -2077,7 +2070,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
public Comparator<TOP> getAnnotationFsComparatorWithoutId() {
- Comparator<TOP> r = this.sii.annotationFsComparatorWithoutId;
+ Comparator<TOP> r = sii.annotationFsComparatorWithoutId;
// lazy creation
if (null != r) {
return r;
@@ -2086,7 +2079,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
}
Comparator<TOP> getAnnotationFsComparatorWithId() {
- Comparator<TOP> r = this.sii.annotationFsComparatorWithId;
+ Comparator<TOP> r = sii.annotationFsComparatorWithId;
// lazy creation
if (null != r) {
return r;
@@ -2098,7 +2091,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
final LinearTypeOrder lto = getDefaultTypeOrder(); // used as constant in comparator
if (!V2_ANNOTATION_COMPARE_TYPE_ORDER && lto.isEmptyTypeOrder()) {
- return this.sii.annotationFsComparatorWithoutId = (fsx1, fsx2) -> {
+ return sii.annotationFsComparatorWithoutId = (fsx1, fsx2) -> {
if (fsx1 == fsx2)
return 0;
Annotation fs1 = (Annotation) fsx1;
@@ -2107,7 +2100,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
};
} else {
- return this.sii.annotationFsComparatorWithoutId = (fsx1, fsx2) -> {
+ return sii.annotationFsComparatorWithoutId = (fsx1, fsx2) -> {
if (fsx1 == fsx2)
return 0;
Annotation fs1 = (Annotation) fsx1;
@@ -2128,7 +2121,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
final LinearTypeOrder lto = getDefaultTypeOrder(); // used as constant in comparator
if (!V2_ANNOTATION_COMPARE_TYPE_ORDER && lto.isEmptyTypeOrder()) {
- this.sii.annotationFsComparatorWithId = (fsx1, fsx2) -> {
+ sii.annotationFsComparatorWithId = (fsx1, fsx2) -> {
if (fsx1 == fsx2)
return 0;
final Annotation fs1 = (Annotation) fsx1;
@@ -2137,7 +2130,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
};
} else {
- this.sii.annotationFsComparatorWithId = (fsx1, fsx2) -> {
+ sii.annotationFsComparatorWithId = (fsx1, fsx2) -> {
if (fsx1 == fsx2)
return 0;
final Annotation fs1 = (Annotation) fsx1;
@@ -2145,7 +2138,7 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
return fs1.compareAnnotationWithId(fs2, lto);
};
}
- return this.sii.annotationFsComparatorWithId;
+ return sii.annotationFsComparatorWithId;
}
/**
@@ -2181,15 +2174,15 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
private Comparator<TOP> getCachedComparator(FSComparators withId, FSComparators withTypeOrder) {
if (withId == FSComparators.WITH_ID) {
if (withTypeOrder == FSComparators.WITH_TYPE_ORDER) {
- return this.sii.annotationFsComparatorWithId;
+ return sii.annotationFsComparatorWithId;
} else {
- return this.sii.annotationFsComparatorNoTypeWithId;
+ return sii.annotationFsComparatorNoTypeWithId;
}
} else {
if (withTypeOrder == FSComparators.WITH_TYPE_ORDER) {
- return this.sii.annotationFsComparatorWithoutId;
+ return sii.annotationFsComparatorWithoutId;
} else {
- return this.sii.annotationFsComparatorNoTypeWithoutId;
+ return sii.annotationFsComparatorNoTypeWithoutId;
}
}
}
@@ -2198,15 +2191,15 @@ public class FSIndexRepositoryImpl implements FSIndexRepositoryMgr, LowLevelInde
Comparator<TOP> c) {
if (withId == FSComparators.WITH_ID) {
if (withTypeOrder == FSComparators.WITH_TYPE_ORDER) {
- this.sii.annotationFsComparatorWithId = c;
+ sii.annotationFsComparatorWithId = c;
} else {
- this.sii.annotationFsComparatorNoTypeWithId = c;
+ sii.annotationFsComparatorNoTypeWithId = c;
}
} else {
if (withTypeOrder == FSComparators.WITH_TYPE_ORDER) {
- this.sii.annotationFsComparatorWithoutId = c;
+ sii.annotationFsComparatorWithoutId = c;
} else {
- this.sii.annotationFsComparatorNoTypeWithoutId = c;
+ sii.annotationFsComparatorNoTypeWithoutId = c;
}
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIntConstraintImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIntConstraintImpl.java
index db7286d3e..bbe067f58 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIntConstraintImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIntConstraintImpl.java
@@ -47,41 +47,41 @@ class FSIntConstraintImpl implements FSIntConstraint {
private IntVector values;
FSIntConstraintImpl() {
- this.codes = new IntVector();
- this.values = new IntVector();
+ codes = new IntVector();
+ values = new IntVector();
}
@Override
public boolean match(int j) {
- final int max = this.codes.size();
+ final int max = codes.size();
for (int i = 0; i < max; i++) {
- switch (this.codes.get(i)) {
+ switch (codes.get(i)) {
case LT: {
- if (j >= this.values.get(i)) {
+ if (j >= values.get(i)) {
return false;
}
break;
}
case LEQ: {
- if (j > this.values.get(i)) {
+ if (j > values.get(i)) {
return false;
}
break;
}
case EQ: {
- if (j != this.values.get(i)) {
+ if (j != values.get(i)) {
return false;
}
break;
}
case GEQ: {
- if (j < this.values.get(i)) {
+ if (j < values.get(i)) {
return false;
}
break;
}
case GT: {
- if (j <= this.values.get(i)) {
+ if (j <= values.get(i)) {
return false;
}
break;
@@ -103,8 +103,8 @@ class FSIntConstraintImpl implements FSIntConstraint {
*/
@Override
public void eq(int i) {
- this.codes.add(EQ);
- this.values.add(i);
+ codes.add(EQ);
+ values.add(i);
}
/**
@@ -115,8 +115,8 @@ class FSIntConstraintImpl implements FSIntConstraint {
*/
@Override
public void lt(int i) {
- this.codes.add(LT);
- this.values.add(i);
+ codes.add(LT);
+ values.add(i);
}
/**
@@ -127,8 +127,8 @@ class FSIntConstraintImpl implements FSIntConstraint {
*/
@Override
public void leq(int i) {
- this.codes.add(LEQ);
- this.values.add(i);
+ codes.add(LEQ);
+ values.add(i);
}
/**
@@ -139,8 +139,8 @@ class FSIntConstraintImpl implements FSIntConstraint {
*/
@Override
public void gt(int i) {
- this.codes.add(GT);
- this.values.add(i);
+ codes.add(GT);
+ values.add(i);
}
/**
@@ -151,22 +151,22 @@ class FSIntConstraintImpl implements FSIntConstraint {
*/
@Override
public void geq(int i) {
- this.codes.add(GEQ);
- this.values.add(i);
+ codes.add(GEQ);
+ values.add(i);
}
@Override
public String toString() {
- if (this.codes.size() == 1) {
- return FSFloatConstraintImpl.toString(this.codes.get(0)) + " "
- + Integer.toString(this.values.get(0));
+ if (codes.size() == 1) {
+ return FSFloatConstraintImpl.toString(codes.get(0)) + " "
+ + Integer.toString(values.get(0));
}
StringBuffer buf = new StringBuffer();
buf.append("( ");
- for (int i = 0; i < this.codes.size(); i++) {
- buf.append(FSFloatConstraintImpl.toString(this.codes.get(i)));
+ for (int i = 0; i < codes.size(); i++) {
+ buf.append(FSFloatConstraintImpl.toString(codes.get(i)));
buf.append(' ');
- buf.append(Integer.toString(this.values.get(i)));
+ buf.append(Integer.toString(values.get(i)));
buf.append(' ');
}
buf.append(')');
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSStringConstraintImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSStringConstraintImpl.java
index d3a009d80..da69d19ef 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSStringConstraintImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSStringConstraintImpl.java
@@ -37,20 +37,20 @@ class FSStringConstraintImpl implements FSStringConstraint {
* Constructor is package private.
*/
FSStringConstraintImpl() {
- this.string = "";
+ string = "";
}
@Override
public void equals(String s) {
- this.string = s;
+ string = s;
}
@Override
public boolean match(String s) {
- if (this.string == null) {
+ if (string == null) {
return (s == null);
}
- return (this.string.equals(s));
+ return (string.equals(s));
}
@Override
@@ -58,8 +58,8 @@ class FSStringConstraintImpl implements FSStringConstraint {
// need to escape quotes and backslashes
StringBuffer buf = new StringBuffer();
buf.append("= \"");
- for (int i = 0; i < this.string.length(); i++) {
- char c = this.string.charAt(i);
+ for (int i = 0; i < string.length(); i++) {
+ char c = string.charAt(i);
switch (c) {
case '"':
buf.append("\\\"");
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java
index 5abe0b475..a372c2567 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSTypeConstraintImpl.java
@@ -47,7 +47,7 @@ class FSTypeConstraintImpl implements FSTypeConstraint {
final FeatureStructureImplC fsi = (FeatureStructureImplC) fs;
compile(fsi.getCAS().getTypeSystem());
final int typeCode = fsi._getTypeCode();
- TypeSystemImpl tsi = (TypeSystemImpl) this.ts;
+ TypeSystemImpl tsi = (TypeSystemImpl) ts;
for (int i = 0; i < typeSet.size(); i++) {
if (tsi.subsumes(typeSet.get(i), typeCode)) {
return true;
@@ -74,7 +74,7 @@ class FSTypeConstraintImpl implements FSTypeConstraint {
@Override
public void add(Type type) {
- this.ts = null; // This will force a recompile.
+ ts = null; // This will force a recompile.
nameSet.add(type.getName());
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
index bec673535..6876c8fa5 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
@@ -82,38 +82,38 @@ public class FeatureImpl implements Feature {
* used to make singleton which is used for "missing feature"
*/
private FeatureImpl() {
- this.featureCode = 0;
- this.isInInt = false;
- this.rangeType = null;
- this.isMultipleRefsAllowed = false;
- this.isAnnotBaseSofaRef = false;
- this.shortName = null;
- this.slotKind = null;
- this.rangeTypeClass = 0;
- this.isLongOrDouble = false;
- this.highestDefiningType = null;
- this.hashCodeLong = computeHashCodeLong();
+ featureCode = 0;
+ isInInt = false;
+ rangeType = null;
+ isMultipleRefsAllowed = false;
+ isAnnotBaseSofaRef = false;
+ shortName = null;
+ slotKind = null;
+ rangeTypeClass = 0;
+ isLongOrDouble = false;
+ highestDefiningType = null;
+ hashCodeLong = computeHashCodeLong();
}
FeatureImpl(TypeImpl typeImpl, String shortName, TypeImpl rangeType, TypeSystemImpl tsi,
boolean isMultipleRefsAllowed, SlotKind slotKind) {
// this.code = code;
- this.highestDefiningType = typeImpl;
+ highestDefiningType = typeImpl;
List<FeatureImpl> feats = (tsi == null) ? null : tsi.features;
- this.featureCode = (feats == null) ? -1 : feats.size();
+ featureCode = (feats == null) ? -1 : feats.size();
this.rangeType = rangeType;
- this.isLongOrDouble = (rangeType == null) ? false : rangeType.isLongOrDouble;
+ isLongOrDouble = (rangeType == null) ? false : rangeType.isLongOrDouble;
this.slotKind = slotKind;
this.shortName = shortName;
this.isMultipleRefsAllowed = isMultipleRefsAllowed;
- this.isAnnotBaseSofaRef = (highestDefiningType == null) ? false
+ isAnnotBaseSofaRef = (highestDefiningType == null) ? false
: ((highestDefiningType.getCode() == TypeSystemConstants.annotBaseTypeCode)
&& shortName.equals(CAS.FEATURE_BASE_NAME_SOFA));
- this.isInInt = (rangeType == null) ? false : (rangeType.getTypeSystem().isInInt(rangeType));
- this.rangeTypeClass = (rangeType == null) ? CASImpl.TYPE_CLASS_FS
+ isInInt = (rangeType == null) ? false : (rangeType.getTypeSystem().isInInt(rangeType));
+ rangeTypeClass = (rangeType == null) ? CASImpl.TYPE_CLASS_FS
: CasSerializerSupport.classifyType(rangeType);
- this.hashCodeLong = computeHashCodeLong();
+ hashCodeLong = computeHashCodeLong();
if (typeImpl != null) {
// if typeImpl is null, this is a "jcas only" defined feature, not a real feature
typeImpl.addFeature(this); // might throw if existing feature with different range
@@ -125,7 +125,7 @@ public class FeatureImpl implements Feature {
* @return the internal code of this feature. Necessary when using low-level APIs.
*/
public int getCode() {
- return this.featureCode;
+ return featureCode;
}
/**
@@ -135,7 +135,7 @@ public class FeatureImpl implements Feature {
*/
@Override
public Type getDomain() {
- return this.highestDefiningType;
+ return highestDefiningType;
}
/**
@@ -144,15 +144,15 @@ public class FeatureImpl implements Feature {
*/
@Override
public Type getRange() {
- return this.rangeType;
+ return rangeType;
}
public TypeImpl getRangeImpl() {
- return this.rangeType;
+ return rangeType;
}
public SlotKind getSlotKind() {
- return this.slotKind;
+ return slotKind;
}
/**
@@ -168,7 +168,7 @@ public class FeatureImpl implements Feature {
@Override
public String getShortName() {
- return this.shortName;
+ return shortName;
}
@Override
@@ -186,7 +186,7 @@ public class FeatureImpl implements Feature {
@Override
public boolean isMultipleReferencesAllowed() {
- return this.isMultipleRefsAllowed;
+ return isMultipleRefsAllowed;
}
/**
@@ -307,13 +307,13 @@ public class FeatureImpl implements Feature {
// to preserve the compare contract, can't use hash for miscompare
int c;
- c = this.shortName.compareTo(other.shortName);
+ c = shortName.compareTo(other.shortName);
if (c != 0)
return c;
c = highestDefiningType.getName().compareTo(other.highestDefiningType.getName());
if (c != 0)
return c;
- c = Boolean.compare(this.isMultipleRefsAllowed, other.isMultipleRefsAllowed);
+ c = Boolean.compare(isMultipleRefsAllowed, other.isMultipleRefsAllowed);
if (c != 0)
return c;
c = rangeType.getName().compareTo(other.rangeType.getName());
@@ -327,9 +327,7 @@ public class FeatureImpl implements Feature {
public boolean equals(Object obj) {
if (this == obj)
return true;
- if (obj == null)
- return false;
- if (!(obj instanceof FeatureImpl))
+ if ((obj == null) || !(obj instanceof FeatureImpl))
return false;
FeatureImpl other = (FeatureImpl) obj;
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeaturePathImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeaturePathImpl.java
index 6d2e8d001..b0d31c7d7 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeaturePathImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeaturePathImpl.java
@@ -92,21 +92,21 @@ class FeaturePathImpl implements FeaturePath {
public void addFeature(Feature feat) {
// check if currently feature path ends with a built-in function
- if (this.builtInFunction > 0) {
+ if (builtInFunction > 0) {
throw new CASRuntimeException(MESSAGE_DIGEST, "INVALID_FEATURE_PATH_SYNTAX_ADD",
new Object[] { getFeaturePathString(), feat.getShortName() });
}
// add feature to feature path
- this.featurePathElementNames.add(feat.getShortName());
- this.boundFeatures.add((FeatureImpl) feat);
+ featurePathElementNames.add(feat.getShortName());
+ boundFeatures.add((FeatureImpl) feat);
// if current featurePath was already initialized we cannot guarantee that
// the path is still ever valid so we have to evaluate the path on the
// fly.
- if (this.boundBaseType != null && PathValid.NEVER == TypeSystemUtils
- .isPathValid(this.boundBaseType, this.featurePathElementNames)) {
- this.boundBaseType = null; // can't be used for this path
+ if (boundBaseType != null && PathValid.NEVER == TypeSystemUtils
+ .isPathValid(boundBaseType, featurePathElementNames)) {
+ boundBaseType = null; // can't be used for this path
}
}
@@ -117,7 +117,7 @@ class FeaturePathImpl implements FeaturePath {
*/
@Override
public FeatureImpl getFeature(int i) {
- return (this.size() == this.boundFeatures.size()) ? this.boundFeatures.get(i) : null;
+ return (size() == boundFeatures.size()) ? boundFeatures.get(i) : null;
}
/*
@@ -127,7 +127,7 @@ class FeaturePathImpl implements FeaturePath {
*/
@Override
public int size() {
- return this.featurePathElementNames.size();
+ return featurePathElementNames.size();
}
/*
@@ -138,8 +138,8 @@ class FeaturePathImpl implements FeaturePath {
@Override
public void initialize(String featurePath) throws CASException {
- this.builtInFunction = NO_BUILT_IN_FUNCTION;
- this.originalBuiltInName = null;
+ builtInFunction = NO_BUILT_IN_FUNCTION;
+ originalBuiltInName = null;
// throw exception if featurePath is null
if (featurePath == null) {
@@ -157,7 +157,7 @@ class FeaturePathImpl implements FeaturePath {
new Object[] { featurePath, "//" });
}
- this.featurePathElementNames.clear();
+ featurePathElementNames.clear();
// parse feature path into path elements
StringTokenizer tokenizer = new StringTokenizer(featurePath, FEATURE_PATH_SEPARATOR);
while (tokenizer.hasMoreTokens()) {
@@ -165,30 +165,30 @@ class FeaturePathImpl implements FeaturePath {
// check if there are more tokens available, if we are at the last
// token we have to check for built-in functions
if (tokenizer.hasMoreTokens()) {
- this.featurePathElementNames.add(token);
+ featurePathElementNames.add(token);
} else {
// we have the last token, check for built-in functions
int index = -1;
if ((index = token.indexOf(BUILT_IN_FUNCTION_SEPARATOR)) != -1) {
if (index > 0) {
// we have a built-in function that is separated with a ":"
- this.featurePathElementNames.add(token.substring(0, index));
+ featurePathElementNames.add(token.substring(0, index));
}
// get built-in function
originalBuiltInName = token.substring(index + 1);
String builtInFunctionName = originalBuiltInName.toLowerCase();
if (builtInFunctionName.equals(FUNCTION_NAME_COVERED_TEXT)) {
- this.builtInFunction = FUNCTION_COVERED_TEXT;
+ builtInFunction = FUNCTION_COVERED_TEXT;
} else if (builtInFunctionName.equals(FUNCTION_NAME_ID)) {
- this.builtInFunction = FUNCTION_ID;
+ builtInFunction = FUNCTION_ID;
} else if (builtInFunctionName.equals(FUNCTION_NAME_TYPE_NAME)) {
- this.builtInFunction = FUNCTION_TYPE_NAME;
+ builtInFunction = FUNCTION_TYPE_NAME;
} else {
throw new CASException(MESSAGE_DIGEST, "INVALID_FEATURE_PATH_SYNTAX",
new Object[] { featurePath, builtInFunctionName });
}
} else {
- this.featurePathElementNames.add(token);
+ featurePathElementNames.add(token);
}
}
}
@@ -202,20 +202,20 @@ class FeaturePathImpl implements FeaturePath {
@Override
public void typeInit(Type typeAtStartOfFeaturePath) throws CASException {
- this.boundBaseType = (TypeImpl) typeAtStartOfFeaturePath;
+ boundBaseType = (TypeImpl) typeAtStartOfFeaturePath;
// do feature path type initialization only if a featurePath is available
- if (this.featurePathElementNames.size() > 0) {
+ if (featurePathElementNames.size() > 0) {
// LowLevelTypeSystem llTypeSystem = ((TypeImpl) featurePathType)
// .getTypeSystem().getLowLevelTypeSystem();
// store featurePathType
- this.boundBaseType = (TypeImpl) typeAtStartOfFeaturePath;
+ boundBaseType = (TypeImpl) typeAtStartOfFeaturePath;
// validate featurePath for given type
if (PathValid.NEVER == TypeSystemUtils.isPathValid(typeAtStartOfFeaturePath,
- this.featurePathElementNames)) {
+ featurePathElementNames)) {
// invalid featurePath - throw an configuration exception
throw new CASException(MESSAGE_DIGEST, "ERROR_VALIDATE_FEATURE_PATH",
new Object[] { getFeaturePathString(), typeAtStartOfFeaturePath.getName() });
@@ -226,15 +226,15 @@ class FeaturePathImpl implements FeaturePath {
// available in
// one or more subtypes.
- this.boundFeatures.clear(); // reset
+ boundFeatures.clear(); // reset
// object
TypeImpl currentType = (TypeImpl) typeAtStartOfFeaturePath;
// iterate over all featurePathNames and store the resolved CAS
// feature in the boundFeatures list, until one not found
- for (String featName : this.featurePathElementNames) {
+ for (String featName : featurePathElementNames) {
FeatureImpl fi = currentType.getFeatureByBaseName(featName);
if (fi != null) {
- this.boundFeatures.add(fi);
+ boundFeatures.add(fi);
currentType = fi.getRangeImpl();
} else {
break;
@@ -422,11 +422,7 @@ class FeaturePathImpl implements FeaturePath {
@Override
public String getValueAsString(FeatureStructure fs) {
TOP tgtFs = getTargetFs((TOP) fs);
- if (tgtFs == FEATURE_PATH_FAILED) {
- return null;
- }
-
- if (targetType == null) {
+ if ((tgtFs == FEATURE_PATH_FAILED) || (targetType == null)) {
return null;
}
switch (TypeSystemImpl.getTypeClass(targetType)) {
@@ -453,7 +449,7 @@ class FeaturePathImpl implements FeaturePath {
case LowLevelCAS.TYPE_CLASS_DOUBLEARRAY:
case LowLevelCAS.TYPE_CLASS_STRINGARRAY:
case LowLevelCAS.TYPE_CLASS_FSARRAY:
- if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
+ if (builtInFunction > NO_BUILT_IN_FUNCTION) {
return evaluateBuiltInFunction(tgtFs);
}
return ((CommonArrayFS) tgtFs).getValuesAsCommaSeparatedString();
@@ -462,7 +458,7 @@ class FeaturePathImpl implements FeaturePath {
if (tgtFs == null) {
return null;
}
- if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
+ if (builtInFunction > NO_BUILT_IN_FUNCTION) {
return evaluateBuiltInFunction(tgtFs);
}
return tgtFs.toString();
@@ -479,11 +475,11 @@ class FeaturePathImpl implements FeaturePath {
private void throwBuiltInFunctionException(String typeName) {
// get built-in function name
String functionName = null;
- if (this.builtInFunction == FUNCTION_COVERED_TEXT) {
+ if (builtInFunction == FUNCTION_COVERED_TEXT) {
functionName = FUNCTION_NAME_COVERED_TEXT;
- } else if (this.builtInFunction == FUNCTION_ID) {
+ } else if (builtInFunction == FUNCTION_ID) {
functionName = FUNCTION_NAME_ID;
- } else if (this.builtInFunction == FUNCTION_TYPE_NAME) {
+ } else if (builtInFunction == FUNCTION_TYPE_NAME) {
functionName = FUNCTION_NAME_TYPE_NAME;
}
// throw runtime exception
@@ -500,17 +496,17 @@ class FeaturePathImpl implements FeaturePath {
* @return Returns the built-in function value for the given FS.
*/
private String evaluateBuiltInFunction(TOP returnFS) {
- if (this.builtInFunction == FUNCTION_COVERED_TEXT) {
+ if (builtInFunction == FUNCTION_COVERED_TEXT) {
if (returnFS instanceof AnnotationFS) {
return ((AnnotationFS) returnFS).getCoveredText();
} else {
throw new CASRuntimeException(MESSAGE_DIGEST, "BUILT_IN_FUNCTION_NOT_SUPPORTED",
new Object[] { FUNCTION_NAME_COVERED_TEXT, returnFS.getType().getName() });
}
- } else if (this.builtInFunction == FUNCTION_ID) {
+ } else if (builtInFunction == FUNCTION_ID) {
return Integer.toString(returnFS._id);
- } else if (this.builtInFunction == FUNCTION_TYPE_NAME) {
+ } else if (builtInFunction == FUNCTION_TYPE_NAME) {
return returnFS.getType().getName();
}
return null;
@@ -544,7 +540,7 @@ class FeaturePathImpl implements FeaturePath {
return FEATURE_PATH_FAILED;
}
- if (this.featurePathElementNames.size() == 0) {
+ if (featurePathElementNames.size() == 0) {
targetType = fs._getTypeImpl();
return fs;
}
@@ -563,13 +559,13 @@ class FeaturePathImpl implements FeaturePath {
int rangeTypeClass = -1;
// resolve feature path value
- for (int i = 0; i < this.featurePathElementNames.size(); i++) {
+ for (int i = 0; i < featurePathElementNames.size(); i++) {
if (currentFs == null) {
return FEATURE_PATH_FAILED;
}
- if (i < this.boundFeatures.size()) {
- targetFeature = this.boundFeatures.get(i);
+ if (i < boundFeatures.size()) {
+ targetFeature = boundFeatures.get(i);
/*
* It is possible that the previously bound feature isn't valid for this FS. This can happen
* if a type hierarchy defines 2 different features for two different subtypes of type Tt
@@ -615,7 +611,7 @@ class FeaturePathImpl implements FeaturePath {
case LowLevelCAS.TYPE_CLASS_FS:
currentFs = currentFs.getFeatureValue(targetFeature);
if (currentFs == null) {
- if (i == (this.featurePathElementNames.size() - 1)) {
+ if (i == (featurePathElementNames.size() - 1)) {
// at the last element, keep targetType == to the range type
} else {
//@formatter:off
@@ -626,8 +622,8 @@ class FeaturePathImpl implements FeaturePath {
* - the PathValid is ALWAYS
*/
//@formatter:on
- PathValid pathValid = TypeSystemUtils.isPathValid(this.boundBaseType,
- this.featurePathElementNames);
+ PathValid pathValid = TypeSystemUtils.isPathValid(boundBaseType,
+ featurePathElementNames);
if (pathValid == PathValid.POSSIBLE) {
targetType = null; // following v2 design here
}
@@ -648,13 +644,13 @@ class FeaturePathImpl implements FeaturePath {
if (targetFeature == null) {
throw new CASRuntimeException(MESSAGE_DIGEST, "INVALID_FEATURE_PATH_FEATURE_NOT_DEFINED",
new Object[] { getFeaturePathString(), currentFs._getTypeImpl().getName(),
- this.featurePathElementNames.get(i) });
+ featurePathElementNames.get(i) });
}
boundFeatures.add(targetFeature); // cache for future use
}
private void verifyNoBuiltInFunction() {
- if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
+ if (builtInFunction > NO_BUILT_IN_FUNCTION) {
throwBuiltInFunctionException(targetFeature.getRangeImpl().getName());
}
}
@@ -675,7 +671,7 @@ class FeaturePathImpl implements FeaturePath {
}
private void appendBuiltInFunction(StringBuilder sb) {
- if (this.builtInFunction > 0) {
+ if (builtInFunction > 0) {
sb.append(':').append(originalBuiltInName); // because capitalization could be different
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
index 466039532..3aa568f7a 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
@@ -658,7 +658,7 @@ public class FeatureStructureImplC implements FeatureStructureImpl {
* @return the FS or if it was a trampoline, the base FS
*/
public <N extends TOP> N _maybeGetBaseForPearFs() {
- return this._isPearTrampoline() ? _casView.getBaseFsFromTrampoline((N) this) : (N) this;
+ return _isPearTrampoline() ? _casView.getBaseFsFromTrampoline((N) this) : (N) this;
}
/**
@@ -991,11 +991,11 @@ public class FeatureStructureImplC implements FeatureStructureImpl {
*/
@Override
public CAS getCAS() {
- return this._casView;
+ return _casView;
}
public CASImpl getCASImpl() { // was package private 9-03
- return this._casView;
+ return _casView;
}
//@formatter:off
@@ -1062,7 +1062,7 @@ public class FeatureStructureImplC implements FeatureStructureImpl {
if (obj instanceof FeatureStructureImplC) {
FeatureStructureImplC c2 = (FeatureStructureImplC) obj;
- if (c2._id != this._id) {
+ if (c2._id != _id) {
return false;
}
@@ -1107,7 +1107,7 @@ public class FeatureStructureImplC implements FeatureStructureImpl {
private int count;
private PrintReferences() {
- this.count = 0;
+ count = 0;
}
/**
@@ -1122,24 +1122,24 @@ public class FeatureStructureImplC implements FeatureStructureImpl {
return false;
}
if (v.equals("seen once")) {
- tree.put(fs, refNamePrefix + Integer.toString(this.count++));
+ tree.put(fs, refNamePrefix + Integer.toString(count++));
}
return true;
}
String getLabel(FeatureStructure ref) {
- return this.tree.get(ref);
+ return tree.get(ref);
}
int printInfo(FeatureStructure ref) {
- String k = this.tree.get(ref);
+ String k = tree.get(ref);
if (k == null || k.equals("seen once")) {
return NO_LABEL;
}
- if (this.seen.contains(ref)) {
+ if (seen.contains(ref)) {
return JUST_LABEL;
}
- this.seen.add(ref);
+ seen.add(ref);
return WITH_LABEL;
}
@@ -1517,7 +1517,7 @@ public class FeatureStructureImplC implements FeatureStructureImpl {
stringVal = (null == stringVal) ? "<null>" : "\"" + Misc.elideString(stringVal, 80) + "\"";
sb.append(stringVal); // caller adds nl
} else {
- sb.append(this.getFeatureValueAsString(fi));
+ sb.append(getFeatureValueAsString(fi));
}
return sb;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
index 4a7de74f1..e80ec9866 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
@@ -207,24 +207,24 @@ public class FeatureValuePathImpl implements FeatureValuePath {
throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, pathSnippet);
}
- this.childPath = child;
- this.typeNameInSnippet = getTypeInSnippet(pathSnippet);
- this.featureName = getFeatureInSnippet(pathSnippet);
- this.isArrayOrList = false;
- this.isArrayType = false;
+ childPath = child;
+ typeNameInSnippet = getTypeInSnippet(pathSnippet);
+ featureName = getFeatureInSnippet(pathSnippet);
+ isArrayOrList = false;
+ isArrayType = false;
determineArray();
- this.isListType = false;
+ isListType = false;
- this.isCoveredTextFeature = COVERED_TEXT.equals(this.featureName);
- this.isFsIdFeature = FS_ID.equals(this.featureName);
- this.isTypeNameFeature = TYPE_NAME.equals(this.featureName);
- this.isUniqueIdFeature = UNIQUE_ID.equals(this.featureName);
- this.isBracketsOnly = (this.isArrayOrList && this.featureName.length() == 0);
+ isCoveredTextFeature = COVERED_TEXT.equals(featureName);
+ isFsIdFeature = FS_ID.equals(featureName);
+ isTypeNameFeature = TYPE_NAME.equals(featureName);
+ isUniqueIdFeature = UNIQUE_ID.equals(featureName);
+ isBracketsOnly = (isArrayOrList && featureName.length() == 0);
// coveredText() asf. is only valid as the last snippet in a feature
// path
- if ((this.isCoveredTextFeature || this.isFsIdFeature || this.isUniqueIdFeature
- || this.isTypeNameFeature) && child != null) {
+ if ((isCoveredTextFeature || isFsIdFeature || isUniqueIdFeature
+ || isTypeNameFeature) && child != null) {
throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, pathSnippet);
}
@@ -255,47 +255,47 @@ public class FeatureValuePathImpl implements FeatureValuePath {
if (currentFS == 0) {
return null;
}
- if (this.isArrayType) {
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (isArrayType) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
throw new IllegalStateException("feature path denotes an array");
}
- int arrayFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int arrayFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
int arraySize = ((CASImpl) cas).ll_getArraySize(arrayFS);
// if the user specified name[1000], but the array has only 5
// entries for name...
- if (this.arrayIndex >= arraySize) {
+ if (arrayIndex >= arraySize) {
return null;
}
- int typeClass = cas.ll_getTypeClass(this.featureRangeType);
+ int typeClass = cas.ll_getTypeClass(featureRangeType);
switch (typeClass) {
case LowLevelCAS.TYPE_CLASS_FLOATARRAY:
int position = getArrayIndex(arraySize);
return cas.ll_getFloatArrayValue(arrayFS, position, false);
case LowLevelCAS.TYPE_CLASS_FSARRAY:
int childFS = getFsAtIndex(arrayFS, cas, arraySize);
- return this.childPath.evaluateAsFloat(childFS, cas);
+ return childPath.evaluateAsFloat(childFS, cas);
default:
throw new IllegalStateException("feature path snippet is neither float nor fs array");
}
}
- if (this.isListType) {
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (isListType) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
throw new IllegalStateException("feature path denotes an array");
}
- int listFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int listFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
- switch (this.listType) {
+ switch (listType) {
case TYPE_CLASS_FLOATLIST:
return (Float) getValueAtListIndex(cas, listFS);
case TYPE_CLASS_FSLIST:
int childFs = getFsAtListIndex(cas, listFS);
if (childFs != 0) {
- return this.childPath.evaluateAsFloat(childFs, cas);
+ return childPath.evaluateAsFloat(childFs, cas);
}
return null;
default:
@@ -303,17 +303,17 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
}
- if (this.childPath != null) {
- int childFS = cas.ll_getRefValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
- return this.childPath.evaluateAsFloat(childFS, cas);
- } else if (this.isCoveredTextFeature || this.isUniqueIdFeature || this.isFsIdFeature
- || this.isTypeNameFeature) {
+ if (childPath != null) {
+ int childFS = cas.ll_getRefValue(currentFS, featureCode, CAS_TYPE_CHECKS);
+ return childPath.evaluateAsFloat(childFS, cas);
+ } else if (isCoveredTextFeature || isUniqueIdFeature || isFsIdFeature
+ || isTypeNameFeature) {
throw new IllegalStateException("feature path does not denote a float");
} else {
- int typeClass = cas.ll_getTypeClass(this.featureRangeType);
+ int typeClass = cas.ll_getTypeClass(featureRangeType);
switch (typeClass) {
case LowLevelCAS.TYPE_CLASS_FLOAT:
- return cas.ll_getFloatValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
+ return cas.ll_getFloatValue(currentFS, featureCode, CAS_TYPE_CHECKS);
default:
throw new IllegalStateException("feature path does not denote a float");
}
@@ -329,33 +329,33 @@ public class FeatureValuePathImpl implements FeatureValuePath {
return null;
}
- if (this.isArrayType) {
+ if (isArrayType) {
// if the path snippet is [], the currentFS itself is the aray. If
// the path snippet is like authors[], the "authors" feature
// contains the array
- int arrayFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int arrayFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
int arraySize = ((CASImpl) cas).ll_getArraySize(arrayFS);
// if the user specified name[1000], but the array has only 5
// entries for name...
- if (this.arrayIndex >= arraySize) {
+ if (arrayIndex >= arraySize) {
return null;
}
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
// we currently assume that there can only be one [] in the path
// hence, it's safe to say that we can collect floats here
Float[] result = new Float[arraySize];
- if (this.childPath != null) { // this snippet denotes an
+ if (childPath != null) { // this snippet denotes an
// FSArray
// iterate through the snippets, which will return floats
for (int i = 0; i < arraySize; i++) {
int childFS = cas.ll_getRefArrayValue(arrayFS, i, CAS_TYPE_CHECKS);
- result[i] = this.childPath.evaluateAsFloat(childFS, cas);
+ result[i] = childPath.evaluateAsFloat(childFS, cas);
}
} else {
// this snippet denotes a float array, just collect it
@@ -367,15 +367,15 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
// resume evaluation at the correct array entry
int childFS = getFsAtIndex(arrayFS, cas, arraySize);
- return this.childPath.evaluateAsFloatArray(childFS, cas);
- } else if (this.isListType) {
+ return childPath.evaluateAsFloatArray(childFS, cas);
+ } else if (isListType) {
// if the path snippet is [], the currentFS itself is the list. If
// the path snippet is like authors[], the "authors" feature
// contains the list
- int listFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int listFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
ArrayList resultList = (ArrayList) getValueAtListIndex(cas, listFS);
if (resultList == null) {
@@ -386,12 +386,12 @@ public class FeatureValuePathImpl implements FeatureValuePath {
// hence, it's safe to say that we can collect floats here
Float[] result = new Float[resultList.size()];
- if (this.childPath != null) { // this snippet denotes an
+ if (childPath != null) { // this snippet denotes an
// FSList
// iterate through the results , which will return floats
for (int i = 0; i < resultList.size(); i++) {
int childFS = (Integer) resultList.get(i);
- result[i] = this.childPath.evaluateAsFloat(childFS, cas);
+ result[i] = childPath.evaluateAsFloat(childFS, cas);
}
} else {
// this snippet denotes a float list, just collect it
@@ -401,11 +401,11 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
// resume evaluation at the correct list entry
int childFS = getFsAtListIndex(cas, listFS);
- return this.childPath.evaluateAsFloatArray(childFS, cas);
+ return childPath.evaluateAsFloatArray(childFS, cas);
} else {
// resume evaulation with the next snippet
- int childFS = cas.ll_getRefValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
- return this.childPath.evaluateAsFloatArray(childFS, cas);
+ int childFS = cas.ll_getRefValue(currentFS, featureCode, CAS_TYPE_CHECKS);
+ return childPath.evaluateAsFloatArray(childFS, cas);
}
}
@@ -415,46 +415,46 @@ public class FeatureValuePathImpl implements FeatureValuePath {
return null;
}
- if (this.isArrayType) {
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (isArrayType) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
throw new IllegalStateException("feature path denotes an array");
}
- int arrayFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int arrayFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
int arraySize = ((CASImpl) cas).ll_getArraySize(arrayFS);
// if the user specified name[1000], but the array has only 5
// entries for name...
- if (this.arrayIndex >= arraySize) {
+ if (arrayIndex >= arraySize) {
return null;
}
- int typeClass = cas.ll_getTypeClass(this.featureRangeType);
+ int typeClass = cas.ll_getTypeClass(featureRangeType);
switch (typeClass) {
case LowLevelCAS.TYPE_CLASS_INTARRAY:
int position = getArrayIndex(arraySize);
return cas.ll_getIntArrayValue(arrayFS, position, false);
case LowLevelCAS.TYPE_CLASS_FSARRAY:
int childFS = getFsAtIndex(arrayFS, cas, arraySize);
- return this.childPath.evaluateAsInt(childFS, cas);
+ return childPath.evaluateAsInt(childFS, cas);
default:
throw new IllegalStateException("feature path snippet is neither int nor fs array");
}
}
- if (this.isListType) {
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (isListType) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
throw new IllegalStateException("feature path denotes an array");
}
- int listFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int listFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
- switch (this.listType) {
+ switch (listType) {
case TYPE_CLASS_INTEGERLIST:
return (Integer) getValueAtListIndex(cas, listFS);
case TYPE_CLASS_FSLIST:
int childFs = getFsAtListIndex(cas, listFS);
if (childFs != 0) {
- return this.childPath.evaluateAsInt(childFs, cas);
+ return childPath.evaluateAsInt(childFs, cas);
}
return null;
default:
@@ -462,20 +462,20 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
}
- if (this.childPath != null) {
- int childFS = cas.ll_getRefValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
- return this.childPath.evaluateAsInt(childFS, cas);
- } else if (this.isCoveredTextFeature || this.isTypeNameFeature) {
+ if (childPath != null) {
+ int childFS = cas.ll_getRefValue(currentFS, featureCode, CAS_TYPE_CHECKS);
+ return childPath.evaluateAsInt(childFS, cas);
+ } else if (isCoveredTextFeature || isTypeNameFeature) {
throw new IllegalStateException("feature path does not denote an int");
- } else if (this.isFsIdFeature) {
+ } else if (isFsIdFeature) {
return currentFS;
- } else if (this.isUniqueIdFeature) {
+ } else if (isUniqueIdFeature) {
return currentFS; // TODO: return currentFs + chunkId
} else {
- int typeClass = cas.ll_getTypeClass(this.featureRangeType);
+ int typeClass = cas.ll_getTypeClass(featureRangeType);
switch (typeClass) {
case LowLevelCAS.TYPE_CLASS_INT:
- return cas.ll_getIntValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
+ return cas.ll_getIntValue(currentFS, featureCode, CAS_TYPE_CHECKS);
default:
throw new IllegalStateException("feature path does not denote an int");
}
@@ -491,33 +491,33 @@ public class FeatureValuePathImpl implements FeatureValuePath {
return null;
}
- if (this.isArrayType) {
+ if (isArrayType) {
// if the path snippet is [], the currentFS itself is the aray. If
// the path snippet is like authors[], the "authors" feature
// contains the array
- int arrayFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int arrayFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
int arraySize = ((CASImpl) cas).ll_getArraySize(arrayFS);
// if the user specified name[1000], but the array has only 5
// entries for name...
- if (this.arrayIndex >= arraySize) {
+ if (arrayIndex >= arraySize) {
return null;
}
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
// we currently assume that there can only be one [] in the path
// hence, it's safe to say that we can collect integers here
Integer[] result = new Integer[arraySize];
- if (this.childPath != null) { // this snippet denotes an
+ if (childPath != null) { // this snippet denotes an
// FSArray
// iterate through the snippets, which will return integers
for (int i = 0; i < arraySize; i++) {
int childFS = cas.ll_getRefArrayValue(arrayFS, i, CAS_TYPE_CHECKS);
- result[i] = this.childPath.evaluateAsInt(childFS, cas);
+ result[i] = childPath.evaluateAsInt(childFS, cas);
}
} else {
// this snippet denotes an int array, just collect it
@@ -529,15 +529,15 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
// resume evaluation at the correct array entry
int childFS = getFsAtIndex(arrayFS, cas, arraySize);
- return this.childPath.evaluateAsIntArray(childFS, cas);
- } else if (this.isListType) {
+ return childPath.evaluateAsIntArray(childFS, cas);
+ } else if (isListType) {
// if the path snippet is [], the currentFS itself is the list. If
// the path snippet is like authors[], the "authors" feature
// contains the list
- int listFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int listFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
ArrayList resultList = (ArrayList) getValueAtListIndex(cas, listFS);
if (resultList == null) {
@@ -548,12 +548,12 @@ public class FeatureValuePathImpl implements FeatureValuePath {
// hence, it's safe to say that we can collect floats here
Integer[] result = new Integer[resultList.size()];
- if (this.childPath != null) { // this snippet denotes an
+ if (childPath != null) { // this snippet denotes an
// FSList
// iterate through the results , which will return floats
for (int i = 0; i < resultList.size(); i++) {
int childFS = (Integer) resultList.get(i);
- result[i] = this.childPath.evaluateAsInt(childFS, cas);
+ result[i] = childPath.evaluateAsInt(childFS, cas);
}
} else {
// this snippet denotes a float list, just collect it
@@ -563,11 +563,11 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
// resume evaluation at the correct list entry
int childFS = getFsAtListIndex(cas, listFS);
- return this.childPath.evaluateAsIntArray(childFS, cas);
+ return childPath.evaluateAsIntArray(childFS, cas);
} else {
// resume evaulation with the next snippet
- int childFS = cas.ll_getRefValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
- return this.childPath.evaluateAsIntArray(childFS, cas);
+ int childFS = cas.ll_getRefValue(currentFS, featureCode, CAS_TYPE_CHECKS);
+ return childPath.evaluateAsIntArray(childFS, cas);
}
}
@@ -588,46 +588,46 @@ public class FeatureValuePathImpl implements FeatureValuePath {
return null;
}
- if (this.isArrayType) {
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (isArrayType) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
throw new IllegalStateException("feature path denotes an array");
}
- int arrayFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int arrayFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
int arraySize = ((CASImpl) cas).ll_getArraySize(arrayFS);
// if the user specified name[1000], but the array has only 5
// entries for name...
- if (this.arrayIndex >= arraySize) {
+ if (arrayIndex >= arraySize) {
return null;
}
- int typeClass = cas.ll_getTypeClass(this.featureRangeType);
+ int typeClass = cas.ll_getTypeClass(featureRangeType);
switch (typeClass) {
case LowLevelCAS.TYPE_CLASS_STRINGARRAY:
int position = getArrayIndex(arraySize);
return cas.ll_getStringArrayValue(arrayFS, position, false);
case LowLevelCAS.TYPE_CLASS_FSARRAY:
int childFS = getFsAtIndex(arrayFS, cas, arraySize);
- return this.childPath.evaluateAsString(childFS, cas);
+ return childPath.evaluateAsString(childFS, cas);
default:
throw new IllegalStateException("feature path snippet is neither string nor fs array");
}
}
- if (this.isListType) {
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (isListType) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
throw new IllegalStateException("feature path denotes an array");
}
- int listFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int listFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
- switch (this.listType) {
+ switch (listType) {
case TYPE_CLASS_STRINGLIST:
return (String) getValueAtListIndex(cas, listFS);
case TYPE_CLASS_FSLIST:
int childFs = getFsAtListIndex(cas, listFS);
if (childFs != 0) {
- return this.childPath.evaluateAsString(childFs, cas);
+ return childPath.evaluateAsString(childFs, cas);
}
return null;
default:
@@ -635,24 +635,24 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
}
- if (this.childPath != null) {
- int childFS = cas.ll_getRefValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
- return this.childPath.evaluateAsString(childFS, cas);
- } else if (this.isCoveredTextFeature) {
+ if (childPath != null) {
+ int childFS = cas.ll_getRefValue(currentFS, featureCode, CAS_TYPE_CHECKS);
+ return childPath.evaluateAsString(childFS, cas);
+ } else if (isCoveredTextFeature) {
AnnotationFS annotation = (AnnotationFS) cas.ll_getFSForRef(currentFS);
return annotation.getCoveredText();
- } else if (this.isTypeNameFeature) {
+ } else if (isTypeNameFeature) {
Type type = cas.ll_getTypeSystem().ll_getTypeForCode(cas.ll_getFSRefType(currentFS));
return type.getName();
- } else if (this.isFsIdFeature) {
+ } else if (isFsIdFeature) {
throw new IllegalStateException("feature path denotes fsId()");
- } else if (this.isUniqueIdFeature) {
+ } else if (isUniqueIdFeature) {
throw new IllegalStateException("feature path denotes uniqueId()");
} else {
- int typeClass = cas.ll_getTypeClass(this.featureRangeType);
+ int typeClass = cas.ll_getTypeClass(featureRangeType);
switch (typeClass) {
case LowLevelCAS.TYPE_CLASS_STRING:
- return cas.ll_getStringValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
+ return cas.ll_getStringValue(currentFS, featureCode, CAS_TYPE_CHECKS);
case LowLevelCAS.TYPE_CLASS_FLOAT:
throw new IllegalStateException("feature path denotes a float");
case LowLevelCAS.TYPE_CLASS_INT:
@@ -672,27 +672,27 @@ public class FeatureValuePathImpl implements FeatureValuePath {
return null;
}
- if (this.isArrayType) {
+ if (isArrayType) {
// if the path snippet is [], the currentFS itself is the aray. If
// the path snippet is like authors[], the "authors" feature
// contains the array
- int arrayFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int arrayFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
int arraySize = ((CASImpl) cas).ll_getArraySize(arrayFS);
// if the user specified name[1000], but the array has only 5
// entries for name...
- if (this.arrayIndex >= arraySize) {
+ if (arrayIndex >= arraySize) {
return null;
}
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
// we currently assume that there can only be one [] in the path
// hence, it's safe to say that we can collect strings here
String[] result = new String[arraySize];
- if (this.childPath != null) { // this snippet denotes an
+ if (childPath != null) { // this snippet denotes an
// FSArray
// iterate through the snippets, which will return Strings
// example author[]/name: author points to an FSArray of
@@ -700,7 +700,7 @@ public class FeatureValuePathImpl implements FeatureValuePath {
// the loop below collects their names as strings
for (int i = 0; i < arraySize; i++) {
int childFS = cas.ll_getRefArrayValue(arrayFS, i, CAS_TYPE_CHECKS);
- result[i] = this.childPath.evaluateAsString(childFS, cas);
+ result[i] = childPath.evaluateAsString(childFS, cas);
}
} else {
// arrayFS itself denotes a String array, just collect it
@@ -713,15 +713,15 @@ public class FeatureValuePathImpl implements FeatureValuePath {
// the snippet is like ...[1] or ...[last]
// resume evaluation at the correct array entry
int childFS = getFsAtIndex(arrayFS, cas, arraySize);
- return this.childPath.evaluateAsStringArray(childFS, cas);
- } else if (this.isListType) {
+ return childPath.evaluateAsStringArray(childFS, cas);
+ } else if (isListType) {
// if the path snippet is [], the currentFS itself is the list. If
// the path snippet is like authors[], the "authors" feature
// contains the list
- int listFS = (this.isBracketsOnly ? currentFS
- : cas.ll_getRefValue(currentFS, this.featureCode));
+ int listFS = (isBracketsOnly ? currentFS
+ : cas.ll_getRefValue(currentFS, featureCode));
- if (this.arrayIndex == USE_ALL_ENTRIES) {
+ if (arrayIndex == USE_ALL_ENTRIES) {
ArrayList resultList = (ArrayList) getValueAtListIndex(cas, listFS);
if (resultList == null) {
@@ -732,12 +732,12 @@ public class FeatureValuePathImpl implements FeatureValuePath {
// hence, it's safe to say that we can collect floats here
String[] result = new String[resultList.size()];
- if (this.childPath != null) { // this snippet denotes an
+ if (childPath != null) { // this snippet denotes an
// FSList
// iterate through the results , which will return floats
for (int i = 0; i < resultList.size(); i++) {
int childFS = (Integer) resultList.get(i);
- result[i] = this.childPath.evaluateAsString(childFS, cas);
+ result[i] = childPath.evaluateAsString(childFS, cas);
}
} else {
// this snippet denotes a float list, just collect it
@@ -747,13 +747,13 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
// resume evaluation at the correct list entry
int childFS = getFsAtListIndex(cas, listFS);
- return this.childPath.evaluateAsStringArray(childFS, cas);
+ return childPath.evaluateAsStringArray(childFS, cas);
} else {
// this is just an intermediate feature (like "metadata" in
// metadata/author[]/name)
// resume evaulation with the next snippet
- int childFS = cas.ll_getRefValue(currentFS, this.featureCode, CAS_TYPE_CHECKS);
- return this.childPath.evaluateAsStringArray(childFS, cas);
+ int childFS = cas.ll_getRefValue(currentFS, featureCode, CAS_TYPE_CHECKS);
+ return childPath.evaluateAsStringArray(childFS, cas);
}
}
@@ -773,10 +773,10 @@ public class FeatureValuePathImpl implements FeatureValuePath {
*/
@Override
public int getFSType() {
- if (this.isSimpleRangeType) {
- return this.typeCode;
+ if (isSimpleRangeType) {
+ return typeCode;
}
- return this.childPath.getFSType();
+ return childPath.getFSType();
}
/**
@@ -795,66 +795,66 @@ public class FeatureValuePathImpl implements FeatureValuePath {
*/
@Override
public String getValueType() {
- if (this.valueTypeName == null) {
- this.valueTypeName = this.childPath.getValueType();
- if (this.arrayIndex == USE_ALL_ENTRIES) {
- if (CAS.TYPE_NAME_STRING.equals(this.valueTypeName)) {
- this.valueTypeName = CAS.TYPE_NAME_STRING_ARRAY;
- } else if (CAS.TYPE_NAME_INTEGER.equals(this.valueTypeName)) {
- this.valueTypeName = CAS.TYPE_NAME_INTEGER_ARRAY;
- } else if (CAS.TYPE_NAME_FLOAT.equals(this.valueTypeName)) {
- this.valueTypeName = CAS.TYPE_NAME_FLOAT_ARRAY;
+ if (valueTypeName == null) {
+ valueTypeName = childPath.getValueType();
+ if (arrayIndex == USE_ALL_ENTRIES) {
+ if (CAS.TYPE_NAME_STRING.equals(valueTypeName)) {
+ valueTypeName = CAS.TYPE_NAME_STRING_ARRAY;
+ } else if (CAS.TYPE_NAME_INTEGER.equals(valueTypeName)) {
+ valueTypeName = CAS.TYPE_NAME_INTEGER_ARRAY;
+ } else if (CAS.TYPE_NAME_FLOAT.equals(valueTypeName)) {
+ valueTypeName = CAS.TYPE_NAME_FLOAT_ARRAY;
}
}
}
- return this.valueTypeName;
+ return valueTypeName;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
- if (this.typeNameInSnippet != null) {
- result.append(this.typeNameInSnippet);
+ if (typeNameInSnippet != null) {
+ result.append(typeNameInSnippet);
result.append(TypeSystem.FEATURE_SEPARATOR);
}
- result.append(this.featureName);
- if (this.isArrayOrList) {
+ result.append(featureName);
+ if (isArrayOrList) {
result.append('[');
- if (!this.isBracketsOnly && this.arrayIndex >= 0) {
- result.append(this.arrayIndex);
+ if (!isBracketsOnly && arrayIndex >= 0) {
+ result.append(arrayIndex);
}
- if (this.arrayIndex == LAST_ARRAY_ENTRY) {
+ if (arrayIndex == LAST_ARRAY_ENTRY) {
result.append(LAST_ARRAY_ENTRY_MARKER);
}
result.append(']');
}
- if (this.childPath != null) {
+ if (childPath != null) {
result.append('/');
- result.append(this.childPath.toString());
+ result.append(childPath.toString());
}
return result.toString();
}
@Override
public void typeSystemInit(int fsType, LowLevelTypeSystem ts) throws CASRuntimeException {
- if (this.typeNameInSnippet != null) { // if the feature path snippet
+ if (typeNameInSnippet != null) { // if the feature path snippet
// defines
// its own
// type,
// we use that one instead of the one that's passed in
- fsType = ts.ll_getCodeForTypeName(this.typeNameInSnippet);
+ fsType = ts.ll_getCodeForTypeName(typeNameInSnippet);
}
if (fsType == LowLevelTypeSystem.UNKNOWN_TYPE_CODE) {
throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH,
- this.typeNameInSnippet);
+ typeNameInSnippet);
}
// the range type denotes what type of FSes (or
// built-in type) is contained in this feature
int rangeTypeCode = LowLevelTypeSystem.UNKNOWN_TYPE_CODE;
- if (!(isBuiltInFeature() || this.isBracketsOnly)) {
+ if (!(isBuiltInFeature() || isBracketsOnly)) {
// find the feature in fsType that corresponds to this path snippet
int[] features = ts.ll_getAppropriateFeatures(fsType);
boolean found = false;
@@ -862,79 +862,79 @@ public class FeatureValuePathImpl implements FeatureValuePath {
int i = 0;
for (; i < features.length && (!found); i++) {
Feature feature = ts.ll_getFeatureForCode(features[i]);
- found = feature.getShortName().equals(this.featureName);
+ found = feature.getShortName().equals(featureName);
}
if (found) {
// store the feature code that corresponds to this path snippet
- this.featureCode = features[i - 1];
- rangeTypeCode = ts.ll_getRangeType(this.featureCode);
+ featureCode = features[i - 1];
+ rangeTypeCode = ts.ll_getRangeType(featureCode);
} else {
Type type = ts.ll_getTypeForCode(fsType);
- throw new CASRuntimeException(CASRuntimeException.INAPPROP_FEAT, this.featureName,
+ throw new CASRuntimeException(CASRuntimeException.INAPPROP_FEAT, featureName,
type.getName());
}
}
- if (this.isBracketsOnly) {
+ if (isBracketsOnly) {
rangeTypeCode = fsType;
}
- this.typeCode = fsType;
+ typeCode = fsType;
// TODO: check mismatch between isArray and the actual rangeTypeCode
// find out whether the type is a "simple" type that may only be used in
// the last snippet of a path
Type type = ts.ll_getTypeForCode(rangeTypeCode);
- this.featureRangeType = rangeTypeCode;
+ featureRangeType = rangeTypeCode;
if (isBuiltInFeature()) {
- this.isSimpleRangeType = true;
+ isSimpleRangeType = true;
} else {
- this.isSimpleRangeType = Arrays.binarySearch(SIMPLE_VAL_TYPES, type.getName()) >= 0;
+ isSimpleRangeType = Arrays.binarySearch(SIMPLE_VAL_TYPES, type.getName()) >= 0;
}
- if (this.isArrayOrList) {
+ if (isArrayOrList) {
int arrayType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_ARRAY_BASE);
- this.isArrayType = ((TypeSystemImpl) ts).subsumes(arrayType, rangeTypeCode);
- if (!this.isArrayType) {
+ isArrayType = ((TypeSystemImpl) ts).subsumes(arrayType, rangeTypeCode);
+ if (!isArrayType) {
// check whether the feature points to a list
- for (int i = 0; i < LIST_TYPE_NAMES.length && !this.isListType; i++) {
+ for (int i = 0; i < LIST_TYPE_NAMES.length && !isListType; i++) {
int candidateType = ts.ll_getCodeForTypeName(LIST_TYPE_NAMES[i]);
- this.isListType = ((TypeSystemImpl) ts).subsumes(candidateType, rangeTypeCode);
- if (this.isListType) {
+ isListType = ((TypeSystemImpl) ts).subsumes(candidateType, rangeTypeCode);
+ if (isListType) {
// determine the type class of the list
- this.listType = i;
+ listType = i;
}
}
// determine the right head and tail feature, depending on the
// list type
- switch (this.listType) {
+ switch (listType) {
case TYPE_CLASS_FSLIST:
- this.headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FS_LIST_HEAD);
- this.tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FS_LIST_TAIL);
+ headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FS_LIST_HEAD);
+ tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FS_LIST_TAIL);
break;
case TYPE_CLASS_STRINGLIST:
- this.headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_STRING_LIST_HEAD);
- this.tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_STRING_LIST_TAIL);
+ headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_STRING_LIST_HEAD);
+ tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_STRING_LIST_TAIL);
break;
case TYPE_CLASS_INTEGERLIST:
- this.headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_INTEGER_LIST_HEAD);
- this.tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_INTEGER_LIST_TAIL);
+ headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_INTEGER_LIST_HEAD);
+ tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_INTEGER_LIST_TAIL);
break;
case TYPE_CLASS_FLOATLIST:
- this.headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FLOAT_LIST_HEAD);
- this.tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FLOAT_LIST_TAIL);
+ headFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FLOAT_LIST_HEAD);
+ tailFeature = ts.ll_getCodeForFeatureName(CAS.FEATURE_FULL_NAME_FLOAT_LIST_TAIL);
break;
default:
break;
}
- this.emptyListTypes = new Type[EMPTY_LIST_TYPE_NAMES.length];
+ emptyListTypes = new Type[EMPTY_LIST_TYPE_NAMES.length];
for (int i = 0; i < EMPTY_LIST_TYPE_NAMES.length; i++) {
- this.emptyListTypes[i] = ts
+ emptyListTypes[i] = ts
.ll_getTypeForCode(ts.ll_getCodeForTypeName(EMPTY_LIST_TYPE_NAMES[i]));
}
@@ -942,61 +942,61 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
- if (this.childPath != null) {
+ if (childPath != null) {
// for simple range types, only [] and fsId() are allowed as child
// path
- if (this.isSimpleRangeType
- && !(this.childPath.isBracketsOnly() || this.childPath.isFsIdFeature)) {
- throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, this.featureName);
+ if (isSimpleRangeType
+ && !(childPath.isBracketsOnly() || childPath.isFsIdFeature)) {
+ throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, featureName);
}
// continue with the child path
- this.childPath.typeSystemInit(rangeTypeCode, ts);
- } else if (this.isCoveredTextFeature) {
+ childPath.typeSystemInit(rangeTypeCode, ts);
+ } else if (isCoveredTextFeature) {
// make sure that the type is a subtype of annotation
int annotationType = ts.ll_getCodeForTypeName(CAS.TYPE_NAME_ANNOTATION);
if (!((TypeSystemImpl) ts).subsumes(annotationType, fsType)) {
- throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, this.featureName);
+ throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, featureName);
}
- this.valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
+ valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
CAS.TYPE_NAME_STRING)];
- } else if (this.isFsIdFeature) {
- this.valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
+ } else if (isFsIdFeature) {
+ valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
CAS.TYPE_NAME_INTEGER)];
- } else if (this.isUniqueIdFeature) {
- this.valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
+ } else if (isUniqueIdFeature) {
+ valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
CAS.TYPE_NAME_INTEGER)];
- } else if (this.isTypeNameFeature) {
- this.valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
+ } else if (isTypeNameFeature) {
+ valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
CAS.TYPE_NAME_STRING)];
} else {
- if (!this.isSimpleRangeType) {
+ if (!isSimpleRangeType) {
CASRuntimeException exception = new CASRuntimeException(
CASRuntimeException.NO_PRIMITIVE_TAIL);
throw exception;
}
- if (this.isArrayOrList && (this.arrayIndex != USE_ALL_ENTRIES)) {
+ if (isArrayOrList && (arrayIndex != USE_ALL_ENTRIES)) {
// in the case of, say, authornames[0], the feature is of type
// string array, but it will evaluate to a string.
- this.valueTypeName = CONTAINER_TO_ELEMENTYPE_MAP.get(type.getName());
- } else if (this.isListType) { // here, we can assume that
+ valueTypeName = CONTAINER_TO_ELEMENTYPE_MAP.get(type.getName());
+ } else if (isListType) { // here, we can assume that
// arrayIndex =
// USE_ALL_ENTRIES
// we don't return lists, but arrays, so we need to map the type
// accordingly
- this.valueTypeName = LIST_TO_ARRAYTYPE_MAP.get(type.getName());
+ valueTypeName = LIST_TO_ARRAYTYPE_MAP.get(type.getName());
} else {
- this.valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
+ valueTypeName = SIMPLE_VAL_TYPES[Arrays.binarySearch(SIMPLE_VAL_TYPES,
type.getName())];
}
}
}
private boolean isBuiltInFeature() {
- return this.isFsIdFeature || this.isUniqueIdFeature || this.isCoveredTextFeature
- || this.isTypeNameFeature;
+ return isFsIdFeature || isUniqueIdFeature || isCoveredTextFeature
+ || isTypeNameFeature;
}
/**
@@ -1008,41 +1008,41 @@ public class FeatureValuePathImpl implements FeatureValuePath {
* If the closing ] is missing, or the number is not an integer
*/
private final void determineArray() throws CASRuntimeException {
- int startIndex = this.featureName.indexOf('[');
+ int startIndex = featureName.indexOf('[');
if (startIndex == -1) {
return;
}
- int endIndex = this.featureName.indexOf(']');
+ int endIndex = featureName.indexOf(']');
if (endIndex == -1) { // we're missing the ending bracket
- throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, this.toString());
+ throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, toString());
}
- this.isArrayOrList = true;
+ isArrayOrList = true;
- String arrayIndexString = this.featureName.substring(startIndex + 1, endIndex);
+ String arrayIndexString = featureName.substring(startIndex + 1, endIndex);
// cut off the array markers from the actual feature name
- this.featureName = this.featureName.substring(0, startIndex);
+ featureName = featureName.substring(0, startIndex);
// determine the array index to use
if (arrayIndexString.equals("")) { // empty brackets, denotes "all
// elements"
- this.arrayIndex = USE_ALL_ENTRIES;
+ arrayIndex = USE_ALL_ENTRIES;
} else if (LAST_ARRAY_ENTRY_MARKER.equalsIgnoreCase(arrayIndexString)) {
// [last],denotes "take the last array element"
- this.arrayIndex = LAST_ARRAY_ENTRY;
+ arrayIndex = LAST_ARRAY_ENTRY;
} else {
try {
- this.arrayIndex = Integer.parseInt(arrayIndexString);
+ arrayIndex = Integer.parseInt(arrayIndexString);
} catch (NumberFormatException e) {
- throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, this.toString());
+ throw new CASRuntimeException(CASRuntimeException.INVALID_FEATURE_PATH, toString());
}
}
}
private int getArrayIndex(int arraySize) {
- return (LAST_ARRAY_ENTRY != this.arrayIndex ? this.arrayIndex : arraySize - 1);
+ return (LAST_ARRAY_ENTRY != arrayIndex ? arrayIndex : arraySize - 1);
}
private final String getFeatureInSnippet(String pathSnippet) {
@@ -1054,7 +1054,7 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
private int getFsAtIndex(int currentFS, LowLevelCAS cas, int arraySize) {
- if (!this.isArrayType) {
+ if (!isArrayType) {
throw new IllegalStateException("FeaturePath is not an array");
}
@@ -1080,7 +1080,7 @@ public class FeatureValuePathImpl implements FeatureValuePath {
* contain an entry for that index.
*/
private int getFsAtListIndex(LowLevelCAS cas, int listFS) {
- if (this.arrayIndex == USE_ALL_ENTRIES || this.listType != TYPE_CLASS_FSLIST) {
+ if (arrayIndex == USE_ALL_ENTRIES || listType != TYPE_CLASS_FSLIST) {
throw new IllegalStateException(
"feature does not denote an fs list, or does not denote a singel array entry");
}
@@ -1095,15 +1095,15 @@ public class FeatureValuePathImpl implements FeatureValuePath {
if (listFS == 0) {
return null;
}
- switch (this.listType) {
+ switch (listType) {
case TYPE_CLASS_STRINGLIST:
- return cas.ll_getStringValue(listFS, this.headFeature);
+ return cas.ll_getStringValue(listFS, headFeature);
case TYPE_CLASS_INTEGERLIST:
- return cas.ll_getIntValue(listFS, this.headFeature);
+ return cas.ll_getIntValue(listFS, headFeature);
case TYPE_CLASS_FLOATLIST:
- return cas.ll_getFloatValue(listFS, this.headFeature);
+ return cas.ll_getFloatValue(listFS, headFeature);
case TYPE_CLASS_FSLIST:
- return cas.ll_getRefValue(listFS, this.headFeature);
+ return cas.ll_getRefValue(listFS, headFeature);
default:
return null;
}
@@ -1128,8 +1128,8 @@ public class FeatureValuePathImpl implements FeatureValuePath {
if (isEmptyList(cas, type)) {
return null;
}
- int listTail = cas.ll_getRefValue(listFS, this.tailFeature);
- switch (this.arrayIndex) {
+ int listTail = cas.ll_getRefValue(listFS, tailFeature);
+ switch (arrayIndex) {
case USE_ALL_ENTRIES:
list.add(getHeadValue(cas, listFS));
return getValueAtIndexRec(cas, listTail, list, ++count);
@@ -1140,7 +1140,7 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
return getHeadValue(cas, listFS);
default:
- if (count == this.arrayIndex) {
+ if (count == arrayIndex) {
return getHeadValue(cas, listFS);
}
return getValueAtIndexRec(cas, listTail, list, ++count);
@@ -1166,15 +1166,15 @@ public class FeatureValuePathImpl implements FeatureValuePath {
}
private boolean isBracketsOnly() {
- return this.isBracketsOnly;
+ return isBracketsOnly;
}
private boolean isEmptyList(LowLevelCAS cas, int type) {
Type candidateType = cas.ll_getTypeSystem().ll_getTypeForCode(type);
TypeSystem typeSystem = ((CASImpl) cas).getTypeSystem();
boolean isEmpty = false;
- for (int i = 0; i < this.emptyListTypes.length && (!isEmpty); i++) {
- isEmpty = typeSystem.subsumes(this.emptyListTypes[i], candidateType);
+ for (int i = 0; i < emptyListTypes.length && (!isEmpty); i++) {
+ isEmpty = typeSystem.subsumes(emptyListTypes[i], candidateType);
}
return isEmpty;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
index 9a36156c9..a33b58316 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
@@ -57,50 +57,50 @@ class FilteredIterator<T extends FeatureStructure> implements LowLevelIterator<T
// at an FS
// that matches the constraint, or is not valid. Thus, for isValid(), we
// can simply refer to the underlying iterator.
- return this.it.isValid();
+ return it.isValid();
}
private void adjustForConstraintForward() {
// If the iterator is valid, but doesn't match the constraint, advance.
- while (this.it.isValid() && !this.cons.match(this.it.get())) {
- this.it.moveToNext();
+ while (it.isValid() && !cons.match(it.get())) {
+ it.moveToNext();
}
}
private void adjustForConstraintBackward() {
// If the iterator is valid, but doesn't match the constraint, advance.
- while (this.it.isValid() && !this.cons.match(this.it.get())) {
- this.it.moveToPrevious();
+ while (it.isValid() && !cons.match(it.get())) {
+ it.moveToPrevious();
}
}
@Override
public void moveToFirstNoReinit() {
- this.it.moveToFirstNoReinit();
+ it.moveToFirstNoReinit();
adjustForConstraintForward();
}
@Override
public void moveToLastNoReinit() {
- this.it.moveToLast();
+ it.moveToLast();
adjustForConstraintBackward();
}
@Override
public void moveToNextNvc() {
- this.it.moveToNextNvc();
+ it.moveToNextNvc();
adjustForConstraintForward();
}
@Override
public void moveToPreviousNvc() {
- this.it.moveToPreviousNvc();
+ it.moveToPreviousNvc();
adjustForConstraintBackward();
}
@Override
public T getNvc() {
- return this.it.getNvc();
+ return it.getNvc();
}
/**
@@ -108,7 +108,7 @@ class FilteredIterator<T extends FeatureStructure> implements LowLevelIterator<T
*/
@Override
public FilteredIterator<T> copy() {
- return new FilteredIterator<>(this.it.copy(), this.cons);
+ return new FilteredIterator<>(it.copy(), cons);
}
/**
@@ -116,7 +116,7 @@ class FilteredIterator<T extends FeatureStructure> implements LowLevelIterator<T
*/
@Override
public void moveToNoReinit(FeatureStructure fs) {
- this.it.moveToNoReinit(fs);
+ it.moveToNoReinit(fs);
adjustForConstraintForward();
}
@@ -148,7 +148,7 @@ class FilteredIterator<T extends FeatureStructure> implements LowLevelIterator<T
@Override
public boolean maybeReinitIterator() {
- return this.it.maybeReinitIterator();
+ return it.maybeReinitIterator();
}
@Override
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java
index 7d92fc7cf..abbaca544 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java
@@ -40,13 +40,13 @@ class FloatConstraint extends PathConstraint implements FSMatchConstraint {
FloatConstraint(ArrayList<String> path, FSFloatConstraint cons) {
super(path);
- this.floatConstraint = cons;
+ floatConstraint = cons;
}
@Override
public boolean match(FeatureStructure fs) {
// compile(((FeatureStructureImpl) fs).getCAS().getTypeSystem());
- final int max = this.featNames.size() - 1; // The last position in the
+ final int max = featNames.size() - 1; // The last position in the
// path!
if (max < 0) {
// If the path is empty, we can't get a float, and therefore the
@@ -55,22 +55,22 @@ class FloatConstraint extends PathConstraint implements FSMatchConstraint {
}
Feature feat;
for (int i = 0; i < max; i++) {
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(i));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(i));
if (feat == null) {
return false;
}
fs = fs.getFeatureValue(feat);
}
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(max));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(max));
if (feat == null) {
return false;
}
- return this.floatConstraint.match(fs.getFloatValue(feat));
+ return floatConstraint.match(fs.getFloatValue(feat));
}
@Override
public String toString() {
- return super.toString() + " " + this.floatConstraint.toString();
+ return super.toString() + " " + floatConstraint.toString();
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
index ef7ac62dc..f3daa38a9 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
@@ -58,7 +58,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
FsIndex_bag(CASImpl cas, Type type, int initialSize, int indexType,
FSIndexComparator comparatorForIndexSpecs) {
super(cas, type, indexType, cleanUpComparator(comparatorForIndexSpecs, cas));
- this.index = new ObjHashSet<>(initialSize, TOP.class, TOP._singleton);
+ index = new ObjHashSet<>(initialSize, TOP.class, TOP._singleton);
}
/**
@@ -150,7 +150,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
*/
@Override
public boolean contains(FeatureStructure fs) {
- return this.index.contains(fs);
+ return index.contains(fs);
}
boolean ll_contains(int fsAddr) {
@@ -166,7 +166,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
*/
@Override
public T find(FeatureStructure fs) {
- final int resultAddr = this.index.find((TOP) fs);
+ final int resultAddr = index.find((TOP) fs);
if (resultAddr >= 0) {
return (T) fs;
}
@@ -179,7 +179,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
*/
@Override
public int size() {
- return this.index.size();
+ return index.size();
}
/**
@@ -190,7 +190,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
public boolean deleteFS(T fs) {
assertFsTypeMatchesIndexType(fs, "deleteFS");
maybeCopy();
- return this.index.remove(fs);
+ return index.remove(fs);
}
// @Override
@@ -205,7 +205,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
@Override
protected void bulkAddTo(List<T> fss) {
- fss.addAll((Collection<? extends T>) this.index);
+ fss.addAll((Collection<? extends T>) index);
}
/*
@@ -224,7 +224,7 @@ public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<
@Override
protected CopyOnWriteIndexPart<T> createCopyOnWriteIndexPart() {
if (CASImpl.traceCow) {
- this.casImpl.traceCowCopy(this);
+ casImpl.traceCowCopy(this);
}
return new CopyOnWriteObjHashSet(index);
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
index b22add25d..858fb5c2a 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
@@ -182,7 +182,7 @@ public class FsIndex_flat<T extends FeatureStructure> extends FsIndex_singletype
*/
@Override
public int size() {
- return this.indexedFSs.length;
+ return indexedFSs.length;
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java
index bccded8f2..c74d217f5 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java
@@ -126,7 +126,7 @@ class FsIndex_iicp<T extends FeatureStructure> extends AbstractCollection<T>
@SuppressWarnings("rawtypes")
final FsIndex_iicp iicp = (FsIndex_iicp) o;
return this.getIndexingStrategy() == iicp.getIndexingStrategy()
- && this.fsIndex_singletype.getComparatorImplForIndexSpecs()
+ && fsIndex_singletype.getComparatorImplForIndexSpecs()
.equals(iicp.fsIndex_singletype.getComparatorImplForIndexSpecs());
}
@@ -139,7 +139,7 @@ class FsIndex_iicp<T extends FeatureStructure> extends AbstractCollection<T>
final int prime = 31;
int result = 1;
// next hashCode includes the type
- result = prime * result + this.fsIndex_singletype.getComparatorImplForIndexSpecs().hashCode();
+ result = prime * result + fsIndex_singletype.getComparatorImplForIndexSpecs().hashCode();
result = prime * result + this.getIndexingStrategy();
return result;
}
@@ -158,7 +158,7 @@ class FsIndex_iicp<T extends FeatureStructure> extends AbstractCollection<T>
return;
}
- final TypeImpl rootType = (TypeImpl) this.fsIndex_singletype.getComparatorImplForIndexSpecs()
+ final TypeImpl rootType = (TypeImpl) fsIndex_singletype.getComparatorImplForIndexSpecs()
.getType();
final int indexKind = this.getIndexingStrategy();
int size = (indexKind == FSIndex.DEFAULT_BAG_INDEX) ? 1
@@ -191,13 +191,13 @@ class FsIndex_iicp<T extends FeatureStructure> extends AbstractCollection<T>
// }
// tempSubIndexCache.add(singleIndex);});
- this.cachedSubFsLeafIndexes = tempSubIndexCache
+ cachedSubFsLeafIndexes = tempSubIndexCache
.toArray(new FsIndex_singletype[tempSubIndexCache.size()]);
if (this.getIndexingStrategy() == FSIndex.SORTED_INDEX) {
Arrays.sort(sortedTypeCodes);
}
// assign to "volatile" at end, after all initialization is complete
- this.isIteratorCacheSetup = true;
+ isIteratorCacheSetup = true;
} // end of synchronized block
}
@@ -240,14 +240,14 @@ class FsIndex_iicp<T extends FeatureStructure> extends AbstractCollection<T>
*/
@Override
public int compareTo(FsIndex_iicp<? extends FeatureStructure> cp) {
- final int typeCode1 = ((TypeImpl) this.fsIndex_singletype.getType()).getCode();
+ final int typeCode1 = ((TypeImpl) fsIndex_singletype.getType()).getCode();
final int typeCode2 = ((TypeImpl) cp.fsIndex_singletype.getType()).getCode();
if (typeCode1 < typeCode2) {
return -1;
} else if (typeCode1 > typeCode2) {
return 1;
} else { // types are equal
- return this.fsIndex_singletype.getComparatorImplForIndexSpecs()
+ return fsIndex_singletype.getComparatorImplForIndexSpecs()
.compareTo(cp.fsIndex_singletype.getComparatorImplForIndexSpecs());
}
}
@@ -302,7 +302,7 @@ class FsIndex_iicp<T extends FeatureStructure> extends AbstractCollection<T>
* @return a guess at the size, done quickly
*/
int guessedSize() {
- final FsIndex_singletype<TOP>[] localIc = this.cachedSubFsLeafIndexes;
+ final FsIndex_singletype<TOP>[] localIc = cachedSubFsLeafIndexes;
final int len = localIc.length;
final int lim = Math.min(3, len);
int size = 0;
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java
index 28b4cff99..afe229d59 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java
@@ -68,13 +68,13 @@ final public class FsIndex_set_sorted<T extends FeatureStructure> extends FsInde
FSIndexComparator comparatorForIndexSpecs) {
super(cas, type, indexType, comparatorForIndexSpecs);
- this.indexedFSs = new OrderedFsSet_array<>(comparatorNoTypeWithID, comparatorNoTypeWithoutID);
+ indexedFSs = new OrderedFsSet_array<>(comparatorNoTypeWithID, comparatorNoTypeWithoutID);
}
@Override
public void flush() {
super.flush();
- this.indexedFSs.clear();
+ indexedFSs.clear();
}
/**
@@ -131,8 +131,8 @@ final public class FsIndex_set_sorted<T extends FeatureStructure> extends FsInde
// @formatter:on
@Override
public T find(FeatureStructure templateKey) {
- int pos = this.indexedFSs.findWithoutID((TOP) templateKey);
- return (pos >= 0) ? this.indexedFSs.getAtPos(pos) : null;
+ int pos = indexedFSs.findWithoutID((TOP) templateKey);
+ return (pos >= 0) ? indexedFSs.getAtPos(pos) : null;
}
// @Override
@@ -196,7 +196,7 @@ final public class FsIndex_set_sorted<T extends FeatureStructure> extends FsInde
*/
@Override
public int size() {
- return this.indexedFSs.size()/* + itemsToBeAdded.size() */;
+ return indexedFSs.size()/* + itemsToBeAdded.size() */;
}
/**
@@ -216,7 +216,7 @@ final public class FsIndex_set_sorted<T extends FeatureStructure> extends FsInde
assertFsTypeMatchesIndexType(fs, "deleteFS");
// maybeProcessBulkAdds(); // moved to OrderedFsSet_array class
maybeCopy();
- return this.indexedFSs.remove(fs);
+ return indexedFSs.remove(fs);
}
@Override
@@ -272,7 +272,7 @@ final public class FsIndex_set_sorted<T extends FeatureStructure> extends FsInde
@Override
protected CopyOnWriteIndexPart createCopyOnWriteIndexPart() {
if (CASImpl.traceCow) {
- this.casImpl.traceCowCopy(this);
+ casImpl.traceCowCopy(this);
}
return new CopyOnWriteOrderedFsSet_array(indexedFSs);
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
index 5cb786bc7..02121ea84 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
@@ -159,18 +159,18 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
protected FsIndex_singletype(CASImpl cas, Type type, int indexType,
FSIndexComparator comparatorForIndexSpecs) {
this.indexType = indexType;
- this.casImpl = cas;
+ casImpl = cas;
this.type = (TypeImpl) type;
- this.typeCode = ((TypeImpl) type).getCode();
+ typeCode = ((TypeImpl) type).getCode();
FSIndexComparatorImpl compForIndexSpecs = (FSIndexComparatorImpl) comparatorForIndexSpecs;
this.comparatorForIndexSpecs = Misc.shareExisting(compForIndexSpecs, comparatorCache);
// this.comparatorForIndexSpecs = compForIndexSpecs/*.copy()*/;
// Initialize the comparator info.
final int nKeys = this.comparatorForIndexSpecs.getNumberOfKeys();
- this.keys = new Object[nKeys];
- this.keyTypeCodes = new int[nKeys];
- this.isReverse = new boolean[nKeys];
+ keys = new Object[nKeys];
+ keyTypeCodes = new int[nKeys];
+ isReverse = new boolean[nKeys];
if (!this.comparatorForIndexSpecs.isValid()) {
isAnnotIdx = false;
@@ -198,7 +198,7 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
.getKeyComparator(i) == FSIndexComparator.REVERSE_STANDARD_COMPARE;
}
- FSIndexRepositoryImpl ir = this.casImpl.indexRepository;
+ FSIndexRepositoryImpl ir = casImpl.indexRepository;
if (ir.isAnnotationIndex(comparatorForIndexSpecs, indexType)) {
comparatorWithID = ir.getAnnotationFsComparator(FSComparators.WITH_ID,
@@ -297,16 +297,16 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
@Override
public FSIndexComparator getComparatorForIndexSpecs() {
- return this.comparatorForIndexSpecs;
+ return comparatorForIndexSpecs;
}
public FSIndexComparatorImpl getComparatorImplForIndexSpecs() {
- return this.comparatorForIndexSpecs;
+ return comparatorForIndexSpecs;
}
@Override
public int getIndexingStrategy() {
- return this.indexType;
+ return indexType;
}
/**
@@ -430,9 +430,7 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
public boolean equals(Object obj) {
if (this == obj)
return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
+ if ((obj == null) || (getClass() != obj.getClass()))
return false;
FsIndex_singletype<?> other = (FsIndex_singletype<?>) obj;
if (comparatorForIndexSpecs == null) {
@@ -449,15 +447,15 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
*/
@Override
public Type getType() {
- return this.type;
+ return type;
}
public TypeImpl getTypeImpl() {
- return this.type;
+ return type;
}
int getTypeCode() {
- return this.typeCode;
+ return typeCode;
}
// /** true if there is a type order key, and no type priorities are defined
@@ -485,7 +483,7 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
@Override
public CASImpl getCasImpl() {
- return this.casImpl;
+ return casImpl;
}
@Override
@@ -527,13 +525,13 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
CopyOnWriteIndexPart<T> n = getCopyOnWriteIndexPart();
if (n != null) {
if (CASImpl.traceCow) {
- this.casImpl.traceCowReinit("reuse", this);
+ casImpl.traceCowReinit("reuse", this);
}
return n;
}
if (CASImpl.traceCow) {
- this.casImpl.traceCowReinit("getNew", this);
+ casImpl.traceCowReinit("getNew", this);
}
// null means index updated since iterator was created, need to make new cow
@@ -589,13 +587,13 @@ public abstract class FsIndex_singletype<T extends FeatureStructure> extends Abs
protected final void assertFsTypeMatchesIndexType(FeatureStructure fs, String operation) {
TypeImpl fsType = ((TOP) fs)._getTypeImpl();
- if (fsType != this.type) {
+ if (fsType != type) {
String message = String.format(
"%s operation using a feature structure of type [%s](%d) from type system [%s] on index using "
+ "different type system [%s] is not supported.",
operation, fsType.getName(), fsType.getCode(),
format("<%,d>", identityHashCode(fsType.getTypeSystem())),
- format("<%,d>", identityHashCode(this.type.getTypeSystem())));
+ format("<%,d>", identityHashCode(type.getTypeSystem())));
if (TypeSystemImpl.IS_ENABLE_STRICT_TYPE_SOURCE_CHECK) {
throw new IllegalArgumentException(message);
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_snapshot.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_snapshot.java
index 5fd826508..1b321e64e 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_snapshot.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_snapshot.java
@@ -46,7 +46,7 @@ public class FsIndex_snapshot<T extends FeatureStructure> extends AbstractCollec
Comparator<TOP> comparatorTypeWithoutId) {
this.wrapped = wrapped;
this.comparatorWithoutId = comparatorWithoutId;
- this.comparatorNoTypeWithoutId = comparatorTypeWithoutId;
+ comparatorNoTypeWithoutId = comparatorTypeWithoutId;
}
/*
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_backwards.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_backwards.java
index 56148a91a..358cdace7 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_backwards.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_backwards.java
@@ -33,7 +33,7 @@ class FsIterator_backwards<T extends FeatureStructure> implements LowLevelIterat
final private LowLevelIterator<T> it; // not just for single-type iterators
FsIterator_backwards(FSIterator<T> iterator) {
- this.it = (LowLevelIterator<T>) iterator;
+ it = (LowLevelIterator<T>) iterator;
it.moveToLast(); // will act like move to first
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
index b4c4dfaf1..f0cfada3b 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
@@ -143,7 +143,7 @@ class FsIterator_bag<T extends FeatureStructure> extends FsIterator_singletype<T
*/
@Override
public FsIterator_bag<T> copy() {
- FsIterator_bag<T> copy = new FsIterator_bag<>(this.fsBagIndex, this.ti, bag);
+ FsIterator_bag<T> copy = new FsIterator_bag<>(fsBagIndex, ti, bag);
copyCommonSetup(copy);
return copy;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag_pear.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag_pear.java
index ba7619999..dc7e6615f 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag_pear.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag_pear.java
@@ -43,7 +43,7 @@ class FsIterator_bag_pear<T extends FeatureStructure> extends FsIterator_bag<T>
@Override
public FsIterator_bag_pear<T> copy() {
- FsIterator_bag_pear<T> copy = new FsIterator_bag_pear<>(this.fsBagIndex, this.ti, this.bag);
+ FsIterator_bag_pear<T> copy = new FsIterator_bag_pear<>(fsBagIndex, ti, bag);
copyCommonSetup(copy);
return copy;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_limited.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_limited.java
index 17ad1a752..0572399ca 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_limited.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_limited.java
@@ -41,7 +41,7 @@ class FsIterator_limited<T extends FeatureStructure> implements LowLevelIterator
FsIterator_limited(FSIterator<T> iterator, int limit) {
this.iterator = (LowLevelIterator<T>) iterator;
this.limit = limit;
- this.limitReached = limit <= count;
+ limitReached = limit <= count;
}
private void maybeMakeInvalid() {
@@ -84,7 +84,7 @@ class FsIterator_limited<T extends FeatureStructure> implements LowLevelIterator
public void moveToFirstNoReinit() {
iterator.moveToFirstNoReinit();
count = 0;
- this.limitReached = limit <= count;
+ limitReached = limit <= count;
}
@Override
@@ -105,7 +105,7 @@ class FsIterator_limited<T extends FeatureStructure> implements LowLevelIterator
count++;
}
}
- this.limitReached = limit <= count;
+ limitReached = limit <= count;
}
@Override
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_multiple_indexes.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_multiple_indexes.java
index 6e9b13499..8ff512dea 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_multiple_indexes.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_multiple_indexes.java
@@ -74,7 +74,7 @@ public abstract class FsIterator_multiple_indexes<T extends FeatureStructure>
public FsIterator_multiple_indexes(LowLevelIndex<T> main_idx, LowLevelIterator<T>[] iterators,
// boolean ignoreType_moveToLeftmost) {
Comparator<TOP> comparatorMaybeNoTypeWithoutId) {
- this.allIterators = iterators;
+ allIterators = iterators;
this.main_idx = main_idx;
this.comparatorMaybeNoTypeWithoutId = comparatorMaybeNoTypeWithoutId;
separate_into_empty_indexes_and_non_empty_iterators();
@@ -88,8 +88,8 @@ public abstract class FsIterator_multiple_indexes<T extends FeatureStructure>
*/
public FsIterator_multiple_indexes(FsIterator_multiple_indexes<T> v) {
allIterators = v.allIterators.clone();
- this.main_idx = v.main_idx;
- this.comparatorMaybeNoTypeWithoutId = v.comparatorMaybeNoTypeWithoutId;
+ main_idx = v.main_idx;
+ comparatorMaybeNoTypeWithoutId = v.comparatorMaybeNoTypeWithoutId;
int i = 0;
for (LowLevelIterator<T> it : allIterators) {
allIterators[i++] = (LowLevelIterator<T>) it.copy();
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted_pear.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted_pear.java
index f97c3e77a..4b6f2967c 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted_pear.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted_pear.java
@@ -48,7 +48,7 @@ class FsIterator_set_sorted_pear<T extends FeatureStructure> extends FsIterator_
@Override
public FsIterator_set_sorted_pear<T> copy() {
FsIterator_set_sorted_pear<T> r = new FsIterator_set_sorted_pear<>(ll_index, ofsa,
- this.comparatorMaybeNoTypeWithoutID);
+ comparatorMaybeNoTypeWithoutID);
copyCommonSetup(r);
return r;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
index a9cfcbd53..097abf887 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
@@ -96,7 +96,7 @@ public abstract class FsIterator_singletype<T extends FeatureStructure>
.append(System.identityHashCode(this));
sb.append(" over Type: ").append(type.getName()).append(":").append(ti.getCode());
sb.append(", index size (may not match current index size): ")
- .append(this.ll_indexSizeMaybeNotCurrent());
+ .append(ll_indexSizeMaybeNotCurrent());
return sb.toString();
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java
index dfa2a63db..31d16808f 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java
@@ -87,12 +87,12 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
dumpIteratorInfo("moveToFirstNoReinit - start");
}
- int lvi = this.nonEmptyIterators.length - 1;
+ int lvi = nonEmptyIterators.length - 1;
// Need to consider all iterators.
// Set all iterators to insertion point.
int i = 0;
while (i <= lvi) {
- final LowLevelIterator<T> it = this.nonEmptyIterators[i];
+ final LowLevelIterator<T> it = nonEmptyIterators[i];
it.moveToFirstNoReinit();
if (it.isValid()) {
heapify_up(it, i, 1);
@@ -100,14 +100,14 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
} else {
// swap this iterator with the last possibly valid one
// lvi might be equal to i, this will not be a problem
- this.nonEmptyIterators[i] = this.nonEmptyIterators[lvi];
- this.nonEmptyIterators[lvi] = it;
+ nonEmptyIterators[i] = nonEmptyIterators[lvi];
+ nonEmptyIterators[lvi] = it;
--lvi;
}
}
// configured to continue with forward iterations
- this.wentForward = true;
- this.lastValidIteratorIndex = lvi;
+ wentForward = true;
+ lastValidIteratorIndex = lvi;
if (DEBUG) {
dumpIteratorInfo("moveToFirstNoReinit - end");
@@ -123,12 +123,12 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
// no need to call isIndexesHaveBeenUpdated because
// there's no state in this iterator that needs updating.
- int lvi = this.nonEmptyIterators.length - 1;
+ int lvi = nonEmptyIterators.length - 1;
// Need to consider all iterators.
// Set all iterators to insertion point.
int i = 0;
while (i <= lvi) {
- final LowLevelIterator<T> it = this.nonEmptyIterators[i];
+ final LowLevelIterator<T> it = nonEmptyIterators[i];
// it.resetConcurrentModification();
it.moveToLastNoReinit();
if (it.isValid()) {
@@ -137,14 +137,14 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
} else {
// swap this iterator with the last possibly valid one
// lvi might be equal to i, this will not be a problem
- this.nonEmptyIterators[i] = this.nonEmptyIterators[lvi];
- this.nonEmptyIterators[lvi] = it;
+ nonEmptyIterators[i] = nonEmptyIterators[lvi];
+ nonEmptyIterators[lvi] = it;
--lvi;
}
}
// configured to continue with backward iterations
- this.wentForward = false;
- this.lastValidIteratorIndex = lvi;
+ wentForward = false;
+ lastValidIteratorIndex = lvi;
if (DEBUG) {
dumpIteratorInfo("moveToLastNoReinit - end");
@@ -159,7 +159,7 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
final LowLevelIterator<T> it0 = nonEmptyIterators[0]/* .checkConcurrentModification() */;
- if (this.wentForward) {
+ if (wentForward) {
it0.moveToNextNvc();
heapify_down(it0, 1);
} else {
@@ -178,7 +178,7 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
*/
private void moveToNextCmn(final LowLevelIterator<T> it0) {
// We need to increment everything.
- int lvi = this.nonEmptyIterators.length - 1;
+ int lvi = nonEmptyIterators.length - 1;
int i = 1;
while (i <= lvi) {
// Any iterator other than the current one needs to be
@@ -203,14 +203,14 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
} else {
// swap this iterator with the last possibly valid one
// lvi might be equal to i, this will not be a problem
- this.nonEmptyIterators[i] = this.nonEmptyIterators[lvi];
- this.nonEmptyIterators[lvi] = it;
+ nonEmptyIterators[i] = nonEmptyIterators[lvi];
+ nonEmptyIterators[lvi] = it;
--lvi;
}
}
- this.lastValidIteratorIndex = lvi;
- this.wentForward = true;
+ lastValidIteratorIndex = lvi;
+ wentForward = true;
it0.moveToNext();
heapify_down(it0, 1);
@@ -224,13 +224,13 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
}
final LowLevelIterator<T> it0 = nonEmptyIterators[0]/* .checkConcurrentModification() */;
- if (!this.wentForward) {
+ if (!wentForward) {
it0.moveToPreviousNvc();
// this also takes care of invalid iterators
heapify_down(it0, -1);
} else {
// We need to decrement everything.
- int lvi = this.nonEmptyIterators.length - 1;
+ int lvi = nonEmptyIterators.length - 1;
int i = 1;
while (i <= lvi) {
// Any iterator other than the current one needs to be
@@ -255,14 +255,14 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
} else {
// swap this iterator with the last possibly valid one
// lvi might be equal to i, this will not be a problem
- this.nonEmptyIterators[i] = this.nonEmptyIterators[lvi];
- this.nonEmptyIterators[lvi] = it;
+ nonEmptyIterators[i] = nonEmptyIterators[lvi];
+ nonEmptyIterators[lvi] = it;
--lvi;
}
}
- this.lastValidIteratorIndex = lvi;
- this.wentForward = false;
+ lastValidIteratorIndex = lvi;
+ wentForward = false;
it0.moveToPrevious();
heapify_down(it0, -1);
@@ -346,25 +346,25 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
while (idx > SORTED_SECTION) {
nidx = (idx + SORTED_SECTION - 1) >> 1;
- if (!is_before(it, this.nonEmptyIterators[nidx], dir)) {
- this.nonEmptyIterators[idx] = it;
+ if (!is_before(it, nonEmptyIterators[nidx], dir)) {
+ nonEmptyIterators[idx] = it;
return;
}
- this.nonEmptyIterators[idx] = this.nonEmptyIterators[nidx];
+ nonEmptyIterators[idx] = nonEmptyIterators[nidx];
idx = nidx;
}
while (idx > 0) {
nidx = idx - 1;
- if (!is_before(it, this.nonEmptyIterators[nidx], dir)) {
- this.nonEmptyIterators[idx] = it;
+ if (!is_before(it, nonEmptyIterators[nidx], dir)) {
+ nonEmptyIterators[idx] = it;
return;
}
- this.nonEmptyIterators[idx] = this.nonEmptyIterators[nidx];
+ nonEmptyIterators[idx] = nonEmptyIterators[nidx];
idx = nidx;
}
- this.nonEmptyIterators[idx] = it;
+ nonEmptyIterators[idx] = it;
}
/**
@@ -385,24 +385,24 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
// if at the end of the iteration, the lastValidIteratorIndex is this one (e.g., is 0)
// and this operation is a noop, but sets the lastValidIteratorIndex to -1, indicating the
// iterator is invalid
- final LowLevelIterator<T> itl = this.nonEmptyIterators[this.lastValidIteratorIndex]/*
+ final LowLevelIterator<T> itl = nonEmptyIterators[lastValidIteratorIndex]/*
* .checkConcurrentModification
* ()
*/;
- this.nonEmptyIterators[this.lastValidIteratorIndex] = it;
- this.nonEmptyIterators[0] = itl;
- --this.lastValidIteratorIndex;
+ nonEmptyIterators[lastValidIteratorIndex] = it;
+ nonEmptyIterators[0] = itl;
+ --lastValidIteratorIndex;
it = itl;
}
- final int num = this.lastValidIteratorIndex;
+ final int num = lastValidIteratorIndex;
if ((num < 1)
- || !is_before(this.nonEmptyIterators[1]/* .checkConcurrentModification() */, it, dir)) {
+ || !is_before(nonEmptyIterators[1]/* .checkConcurrentModification() */, it, dir)) {
return;
}
int idx = 1;
- this.nonEmptyIterators[0] = this.nonEmptyIterators[1];
+ nonEmptyIterators[0] = nonEmptyIterators[1];
final int end = Math.min(num, SORTED_SECTION);
int nidx = idx + 1;
@@ -411,11 +411,11 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
// in case of a concurrent modification
try {
while (nidx <= end) {
- if (!is_before(this.nonEmptyIterators[nidx]/* .checkConcurrentModification() */, it, dir)) {
+ if (!is_before(nonEmptyIterators[nidx]/* .checkConcurrentModification() */, it, dir)) {
return; // passes through finally
}
- this.nonEmptyIterators[idx] = this.nonEmptyIterators[nidx];
+ nonEmptyIterators[idx] = nonEmptyIterators[nidx];
idx = nidx;
nidx = idx + 1;
}
@@ -423,21 +423,21 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
nidx = SORTED_SECTION + 1;
while (nidx <= num) {
if ((nidx < num)
- && is_before(this.nonEmptyIterators[nidx + 1]/* .checkConcurrentModification() */,
- this.nonEmptyIterators[nidx]/* .checkConcurrentModification() */, dir)) {
+ && is_before(nonEmptyIterators[nidx + 1]/* .checkConcurrentModification() */,
+ nonEmptyIterators[nidx]/* .checkConcurrentModification() */, dir)) {
++nidx;
}
- if (!is_before(this.nonEmptyIterators[nidx], it, dir)) {
+ if (!is_before(nonEmptyIterators[nidx], it, dir)) {
return;
}
- this.nonEmptyIterators[idx] = this.nonEmptyIterators[nidx];
+ nonEmptyIterators[idx] = nonEmptyIterators[nidx];
idx = nidx;
nidx = (nidx << 1) - (SORTED_SECTION - 1);
}
} finally {
- this.nonEmptyIterators[idx] = it;
+ nonEmptyIterators[idx] = it;
}
}
@@ -482,12 +482,12 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
// set null unless need special extra type compare
// Type typeCompare = (isSortedAndIgnoringTypeOrderKey) ? fs.getType() : null;
- int lastValidIterator_local = this.nonEmptyIterators.length - 1;
+ int lastValidIterator_local = nonEmptyIterators.length - 1;
// Need to consider all iterators.
// Set all iterators to insertion point.
int i = 0;
while (i <= lastValidIterator_local) {
- final LowLevelIterator<T> it = this.nonEmptyIterators[i];
+ final LowLevelIterator<T> it = nonEmptyIterators[i];
it.moveToNoReinit(fs);
// If the moveTo operation moved the iterator beyond the end (made it invalid), we need to
@@ -541,15 +541,15 @@ public class FsIterator_subtypes_ordered<T extends FeatureStructure>
} else {
// swap this iterator with the last possibly valid one
// lvi might be equal to i, this will not be a problem
- this.nonEmptyIterators[i] = this.nonEmptyIterators[lastValidIterator_local];
- this.nonEmptyIterators[lastValidIterator_local] = it;
+ nonEmptyIterators[i] = nonEmptyIterators[lastValidIterator_local];
+ nonEmptyIterators[lastValidIterator_local] = it;
--lastValidIterator_local;
}
}
// configured to continue with forward iterations
- this.wentForward = true;
- this.lastValidIteratorIndex = lastValidIterator_local;
+ wentForward = true;
+ lastValidIteratorIndex = lastValidIterator_local;
if (DEBUG) {
dumpIteratorInfo("moveToNoReinit - end");
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java
index 51ab82746..645f048d8 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java
@@ -48,11 +48,11 @@ public class FsIterator_subtypes_snapshot<T extends FeatureStructure>
public FsIterator_subtypes_snapshot(FsIndex_flat<T> flatIndex,
Comparator<TOP> comparatorMaybeNoTypeWithoutId) {
- this.indexForComparator = flatIndex;
- this.snapshot = (T[]) flatIndex.getFlatArray();
- this.is_unordered = flatIndex.getIndexingStrategy() != FSIndex.SORTED_INDEX;
+ indexForComparator = flatIndex;
+ snapshot = (T[]) flatIndex.getFlatArray();
+ is_unordered = flatIndex.getIndexingStrategy() != FSIndex.SORTED_INDEX;
this.comparatorMaybeNoTypeWithoutId = comparatorMaybeNoTypeWithoutId;
- this.isNotUimaIndexSource = false;
+ isNotUimaIndexSource = false;
}
/**
@@ -72,11 +72,11 @@ public class FsIterator_subtypes_snapshot<T extends FeatureStructure>
*/
public FsIterator_subtypes_snapshot(T[] snapshot, LowLevelIndex<T> index, boolean is_unordered,
Comparator<TOP> comparatorMaybeNoTypeWithoutId) {
- this.indexForComparator = index;
+ indexForComparator = index;
this.snapshot = snapshot;
this.is_unordered = is_unordered;
this.comparatorMaybeNoTypeWithoutId = comparatorMaybeNoTypeWithoutId;
- this.isNotUimaIndexSource = true;
+ isNotUimaIndexSource = true;
}
/*
@@ -225,8 +225,8 @@ public class FsIterator_subtypes_snapshot<T extends FeatureStructure>
*/
@Override
public FSIterator<T> copy() {
- FsIterator_subtypes_snapshot<T> it = new FsIterator_subtypes_snapshot<>(this.snapshot,
- this.indexForComparator, this.is_unordered, this.comparatorMaybeNoTypeWithoutId);
+ FsIterator_subtypes_snapshot<T> it = new FsIterator_subtypes_snapshot<>(snapshot,
+ indexForComparator, is_unordered, comparatorMaybeNoTypeWithoutId);
it.pos = pos;
return it;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Heap.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Heap.java
index d9220a5db..2da912e67 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Heap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Heap.java
@@ -100,15 +100,15 @@ public final class Heap {
}
private void initHeap() {
- this.heap = new int[this.initialSize];
- this.pos = 1; // 0 is not a valid address
- this.max = this.heap.length;
+ heap = new int[initialSize];
+ pos = 1; // 0 is not a valid address
+ max = heap.length;
}
private void initHeap(int size) {
- this.heap = new int[size];
- this.pos = 1; // 0 is not a valid address
- this.max = this.heap.length;
+ heap = new int[size];
+ pos = 1; // 0 is not a valid address
+ max = heap.length;
}
void reinit(int[] md, int[] shortHeap) {
@@ -119,13 +119,13 @@ public final class Heap {
// assert(md != null);
// assert(shortHeap != null);
final int heapSize = md[SIZE_POS];
- this.pos = md[TMPP_POS];
- this.max = md[TMPM_POS];
- this.initialSize = md[PGSZ_POS];
+ pos = md[TMPP_POS];
+ max = md[TMPM_POS];
+ initialSize = md[PGSZ_POS];
// Copy the shortened version of the heap into a full version.
- this.heap = new int[heapSize];
- System.arraycopy(shortHeap, 0, this.heap, 0, shortHeap.length);
+ heap = new int[heapSize];
+ System.arraycopy(shortHeap, 0, heap, 0, shortHeap.length);
}
@@ -135,16 +135,16 @@ public final class Heap {
* @param shortHeap
*/
private void reinitNoMetaData(int[] shortHeap) {
- this.initialSize = (shortHeap.length < MIN_SIZE) ? MIN_SIZE : shortHeap.length;
- if (shortHeap.length >= this.initialSize) {
- this.heap = shortHeap;
+ initialSize = (shortHeap.length < MIN_SIZE) ? MIN_SIZE : shortHeap.length;
+ if (shortHeap.length >= initialSize) {
+ heap = shortHeap;
} else {
- System.arraycopy(shortHeap, 0, this.heap, 0, shortHeap.length);
+ System.arraycopy(shortHeap, 0, heap, 0, shortHeap.length);
}
// Set position and max.
- this.pos = shortHeap.length;
+ pos = shortHeap.length;
// this.max = this.initialSize;
- this.max = this.heap.length; // heap could be repl by short heap
+ max = heap.length; // heap could be repl by short heap
}
/**
@@ -155,34 +155,34 @@ public final class Heap {
* @param newSize
*/
void reinitSizeOnly(int newSize) {
- this.initialSize = (newSize < MIN_SIZE) ? MIN_SIZE : newSize;
- this.heap = new int[this.initialSize];
+ initialSize = (newSize < MIN_SIZE) ? MIN_SIZE : newSize;
+ heap = new int[initialSize];
// Set position and max.
- this.pos = newSize;
- this.max = this.initialSize;
+ pos = newSize;
+ max = initialSize;
}
/**
* Return the number of cells used (including slot 0 reserved for null)
*/
int getCellsUsed() {
- return this.pos;
+ return pos;
}
/**
* @return The overall size of the heap (in words) (including unused space).
*/
int getHeapSize() {
- return this.heap.length;
+ return heap.length;
}
int[] getMetaData() {
final int arSize = AVST_POS;
int[] ar = new int[arSize];
- ar[SIZE_POS] = this.heap.length;
- ar[TMPP_POS] = this.pos;
- ar[TMPM_POS] = this.max;
- ar[PGSZ_POS] = this.initialSize;
+ ar[SIZE_POS] = heap.length;
+ ar[TMPP_POS] = pos;
+ ar[TMPM_POS] = max;
+ ar[PGSZ_POS] = initialSize;
final int availablePagesSize = 0;
ar[AVSZ_POS] = availablePagesSize;
@@ -191,12 +191,12 @@ public final class Heap {
// Grow the heap.
private void grow() {
- final int start = this.heap.length;
+ final int start = heap.length;
// This will grow the heap by doubling its size if it's smaller than
// MULTIPLICATION_LIMIT, and by MULTIPLICATION_LIMIT if it's larger.
- this.heap = IntArrayUtils.ensure_size(this.heap, start + this.initialSize, 2,
+ heap = IntArrayUtils.ensure_size(heap, start + initialSize, 2,
MULTIPLICATION_LIMIT);
- this.max = this.heap.length;
+ max = heap.length;
}
static int getRoundedSize(int size) {
@@ -239,13 +239,13 @@ public final class Heap {
final int newCapacity = CommonAuxHeap.computeShrunkArraySize(curCapacity, curSize, 2,
MULTIPLICATION_LIMIT, initialSize, shrinkableCount);
if (newCapacity == curCapacity) {
- Arrays.fill(this.heap, 0, this.pos, 0);
+ Arrays.fill(heap, 0, pos, 0);
} else {
if (debugLogShrink)
System.out.format("Debug shrink Heap from %,d to %,d%n", curCapacity, newCapacity);
this.initHeap(newCapacity);
}
- this.pos = 1;
+ pos = 1;
}
}
@@ -258,12 +258,12 @@ public final class Heap {
* structure.
*/
public int add(int[] fs) {
- while ((this.pos + fs.length) >= this.max) {
+ while ((pos + fs.length) >= max) {
grow();
}
- System.arraycopy(fs, 0, this.heap, this.pos, fs.length);
- final int pos1 = this.pos;
- this.pos += fs.length;
+ System.arraycopy(fs, 0, heap, pos, fs.length);
+ final int pos1 = pos;
+ pos += fs.length;
return pos1;
}
@@ -279,12 +279,12 @@ public final class Heap {
* structure.
*/
public int add(int len, int val) {
- while ((this.pos + len) >= this.max) {
+ while ((pos + len) >= max) {
grow();
}
- final int pos1 = this.pos;
- this.pos += len;
- this.heap[pos1] = val;
+ final int pos1 = pos;
+ pos += len;
+ heap[pos1] = val;
return pos1;
}
@@ -293,10 +293,10 @@ public final class Heap {
}
public void grow(int len) {
- while ((this.pos + len) >= this.max) {
+ while ((pos + len) >= max) {
grow();
}
- this.pos += len;
+ pos += len;
}
// used by JCas to default the size the JCasHashMap
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java
index ef5bd4f23..d478578e1 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java
@@ -78,7 +78,7 @@ public class Id2FS implements Iterable<TOP> {
final private int initialSize;
public Id2FS(int initialHeapSize) {
- this.initialSize = Math.max(32, initialHeapSize >> 4); // won't shrink below this
+ initialSize = Math.max(32, initialHeapSize >> 4); // won't shrink below this
id2fs = new JCasHashMap(initialSize);
}
@@ -304,10 +304,7 @@ public class Id2FS implements Iterable<TOP> {
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof MeasureCaller)) {
+ if ((obj == null) || !(obj instanceof MeasureCaller)) {
return false;
}
MeasureCaller other = (MeasureCaller) obj;
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java
index 9f030041d..e0cde12b4 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java
@@ -40,13 +40,13 @@ class IntConstraint extends PathConstraint implements FSMatchConstraint {
IntConstraint(ArrayList<String> path, FSIntConstraint cons) {
super(path);
- this.intConstraint = cons;
+ intConstraint = cons;
}
@Override
public boolean match(FeatureStructure fs) {
// compile(((FeatureStructureImpl) fs).getCAS().getTypeSystem());
- final int max = this.featNames.size() - 1; // The last position in the
+ final int max = featNames.size() - 1; // The last position in the
// path!
if (max < 0) {
// If the path is empty, we can't get an int, and therefore the
@@ -55,22 +55,22 @@ class IntConstraint extends PathConstraint implements FSMatchConstraint {
}
Feature feat;
for (int i = 0; i < max; i++) {
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(i));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(i));
if (feat == null) {
return false;
}
fs = fs.getFeatureValue(feat);
}
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(max));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(max));
if (feat == null) {
return false;
}
- return this.intConstraint.match(fs.getIntValue(feat));
+ return intConstraint.match(fs.getIntValue(feat));
}
@Override
public String toString() {
- return super.toString() + " " + this.intConstraint.toString();
+ return super.toString() + " " + intConstraint.toString();
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LinearTypeOrderBuilderImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LinearTypeOrderBuilderImpl.java
index 4979c89f6..22ca6200d 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LinearTypeOrderBuilderImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LinearTypeOrderBuilderImpl.java
@@ -95,17 +95,17 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
*/
private TotalTypeOrder(int[] typeList, TypeSystem ts, boolean isEmpty) {
TypeSystemImpl tsi = (TypeSystemImpl) ts;
- this.order = typeList;
- final int sz = this.order.length + tsi.getSmallestType();
+ order = typeList;
+ final int sz = order.length + tsi.getSmallestType();
if (sz > 32767) {
/** Total number of UIMA types, {0}, exceeds the maximum of 32766. **/
throw new CASAdminException(CASAdminException.TOO_MANY_TYPES, sz - 1);
}
- this.typeCodeToOrder = new short[this.order.length + tsi.getSmallestType()];
- for (int i = 0; i < this.order.length; i++) {
- this.typeCodeToOrder[this.order[i]] = (short) i;
+ typeCodeToOrder = new short[order.length + tsi.getSmallestType()];
+ for (int i = 0; i < order.length; i++) {
+ typeCodeToOrder[order[i]] = (short) i;
}
- this.isEmptyTypeOrder = isEmpty;
+ isEmptyTypeOrder = isEmpty;
}
/*
@@ -120,7 +120,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
TypeImpl t2 = ((FeatureStructureImplC) fs2)._getTypeImpl();
if (t1 == t2)
return 0;
- return Short.compare(this.typeCodeToOrder[t1.getCode()], this.typeCodeToOrder[t2.getCode()]);
+ return Short.compare(typeCodeToOrder[t1.getCode()], typeCodeToOrder[t2.getCode()]);
}
// Look-up.
@@ -133,13 +133,13 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
@Override
public boolean lessThan(int t1, int t2) {
- return this.typeCodeToOrder[t1] < this.typeCodeToOrder[t2];
+ return typeCodeToOrder[t1] < typeCodeToOrder[t2];
// return this.lt[t1].get(t2);
}
@Override
public int[] getOrder() {
- return this.order;
+ return order;
}
@Override
@@ -156,10 +156,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
TotalTypeOrder other = (TotalTypeOrder) obj;
@@ -186,7 +183,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
}
private void removeAncestor(Node node) {
- this.predecessors.remove(node);
+ predecessors.remove(node);
}
private int outRank() {
@@ -198,21 +195,21 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
}
private ArrayList<GraphNode> getAllPredecessors() {
- return this.predecessors;
+ return predecessors;
}
private ArrayList<GraphNode> getAllSuccessors() {
- return this.successors;
+ return successors;
}
private void removeSuccessor(int i) {
- this.successors.remove(i);
+ successors.remove(i);
}
private void addAllPredecessors(ArrayList<? extends GraphNode> pred) {
for (Iterator<? extends GraphNode> it = pred.iterator(); it.hasNext();) {
Node n = (Node) it.next();
- if (!LinearTypeOrderBuilderImpl.this.order.pathFromTo(this, n)) {
+ if (!order.pathFromTo(this, n)) {
n.connect(this);
}
// else {
@@ -226,7 +223,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
private void addAllSuccessors(ArrayList<? extends GraphNode> successors1) {
for (Iterator<? extends GraphNode> it = successors1.iterator(); it.hasNext();) {
Node n = (Node) it.next();
- if (!LinearTypeOrderBuilderImpl.this.order.pathFromTo(n, this)) {
+ if (!order.pathFromTo(n, this)) {
connect(n);
}
// else {
@@ -244,21 +241,21 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
private final Map<String, Node> nodeMap = new HashMap<>();
private int size() {
- return this.nodeMap.size();
+ return nodeMap.size();
}
private Node getNode(String name) {
- Node node = this.nodeMap.get(name);
+ Node node = nodeMap.get(name);
if (node == null) {
node = new Node(name);
- this.nodeMap.put(name, node);
+ nodeMap.put(name, node);
}
return node;
}
private Graph copy(Node inRank0nodes) {
Graph copy = new Graph();
- Iterator<Map.Entry<String, Node>> it = this.nodeMap.entrySet().iterator();
+ Iterator<Map.Entry<String, Node>> it = nodeMap.entrySet().iterator();
Map.Entry<String, Node> entry;
String key;
// Copy the nodes.
@@ -269,7 +266,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
// node
}
// Set pred's and succ's for nodes.
- it = this.nodeMap.entrySet().iterator();
+ it = nodeMap.entrySet().iterator();
Node origNode, copyNode;
while (it.hasNext()) {
entry = it.next();
@@ -302,7 +299,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
// if (node == null) {
// return ;
// }
- this.nodeMap.remove(node.getElement());
+ nodeMap.remove(node.getElement());
final int max = node.outRank();
for (int i = 0; i < max; i++) {
Node n = (Node) node.getSuccessor(i);
@@ -342,7 +339,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
private TypeSystem ts;
public LinearTypeOrderBuilderImpl(TypeSystem ts) {
- this.order = new Graph();
+ order = new Graph();
this.ts = ts;
}
@@ -373,12 +370,12 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
}
private boolean add(String s1, String s2) {
- final Node n1 = this.order.getNode(s1);
- final Node n2 = this.order.getNode(s2);
- if (this.order.pathFromTo(n1, n2)) {
+ final Node n1 = order.getNode(s1);
+ final Node n2 = order.getNode(s2);
+ if (order.pathFromTo(n1, n2)) {
return true;
}
- if (this.order.pathFromTo(n2, n1)) {
+ if (order.pathFromTo(n2, n1)) {
return false;
}
n1.connect(n2);
@@ -388,7 +385,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
private void addInheritanceTypes() {
List<Type> typesToModify = new ArrayList<>();
- for (Iterator<Type> tsi = this.ts.getTypeIterator(); tsi.hasNext();) {
+ for (Iterator<Type> tsi = ts.getTypeIterator(); tsi.hasNext();) {
Type bottomType = tsi.next();
Type type = bottomType;
@@ -398,28 +395,25 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
while (true) {
String typeName = type.getName();
- final Node n = this.order.getNode(typeName);
+ final Node n = order.getNode(typeName);
if ((nIn == null) && (n.inRank() != 0)) {
nIn = n;
}
if ((nOut == null) && (n.outRank() != 0)) {
nOut = n;
}
- if ((nIn != null) && (nOut != null)) {
- break;
- }
- if (typeName.equals(CAS.TYPE_NAME_TOP)) {
+ if (((nIn != null) && (nOut != null)) || typeName.equals(CAS.TYPE_NAME_TOP)) {
break;
}
typesToModify.add(type);
- type = this.ts.getParent(type);
+ type = ts.getParent(type);
}
boolean doIn = true;
boolean doOut = true;
for (Iterator<Type> ni = typesToModify.iterator(); ni.hasNext();) {
type = ni.next();
String typeName = type.getName();
- final Node n = this.order.getNode(typeName);
+ final Node n = order.getNode(typeName);
if (doIn && (nIn != null)) {
if (n.inRank() == 0) {
n.addAllPredecessors(nIn.getAllPredecessors());
@@ -444,7 +438,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
int origOrderSize = order.size();
addInheritanceTypes();
Node inRank0Nodes = new Node("");
- Graph g = this.order.copy(inRank0Nodes);
+ Graph g = order.copy(inRank0Nodes);
String[] totalOrder = new String[g.size()];
// String s;
@@ -462,7 +456,7 @@ public class LinearTypeOrderBuilderImpl implements LinearTypeOrderBuilder {
// for (int i = 0; i < totalOrder.length; i++) {
// System.out.println(" " + totalOrder[i]);
// }
- return new TotalTypeOrder(totalOrder, this.ts, origOrderSize == 0);
+ return new TotalTypeOrder(totalOrder, ts, origOrderSize == 0);
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongHeap.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongHeap.java
index fef0919c3..d71139422 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongHeap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongHeap.java
@@ -38,17 +38,17 @@ final class LongHeap extends CommonAuxHeap {
@Override
void initMemory() {
- this.heap = new long[this.heapBaseSize];
+ heap = new long[heapBaseSize];
}
@Override
void initMemory(int size) {
- this.heap = new long[size];
+ heap = new long[size];
}
@Override
int getCapacity() {
- return this.heap.length;
+ return heap.length;
}
@Override
@@ -64,12 +64,12 @@ final class LongHeap extends CommonAuxHeap {
@Override
void resetToZeros() {
- Arrays.fill(this.heap, 0, this.heapPos, NULL);
+ Arrays.fill(heap, 0, heapPos, NULL);
}
// Getters
long getHeapValue(int offset) {
- return this.heap[offset];
+ return heap[offset];
}
// setters
@@ -104,7 +104,7 @@ final class LongHeap extends CommonAuxHeap {
heap = new long[argLength];
System.arraycopy(longHeap, 0, heap, 0, argLength);
- this.heapPos = argLength;
+ heapPos = argLength;
}
public long[] toArray() {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongSet.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongSet.java
index f24d71a4b..d6604d488 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongSet.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LongSet.java
@@ -73,7 +73,7 @@ final class LongSet {
}
int getSize() {
- return this.longs.size();
+ return longs.size();
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java
index 6ac198006..aafb47c0f 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelException.java
@@ -112,7 +112,7 @@ public class LowLevelException extends UIMARuntimeException {
/** @return The same as getMessage(), but prefixed with <code>"LowLevelException: "</code>. */
@Override
public String toString() {
- return "LowLevelException: " + this.getMessage();
+ return "LowLevelException: " + getMessage();
}
/**
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java
index e7a8a680b..4d0902e95 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java
@@ -42,7 +42,7 @@ public class MarkerImpl implements Marker {
MarkerImpl(int nextFSId, CASImpl cas) {
this.nextFSId = nextFSId;
this.cas = cas;
- this.isValid = true;
+ isValid = true;
}
@Override
@@ -60,7 +60,7 @@ public class MarkerImpl implements Marker {
if (isNew(fs)) {
return false; // new fs's are not modified ones
}
- return this.cas.isInModifiedPreexisting((TOP) fs);
+ return cas.isInModifiedPreexisting((TOP) fs);
}
boolean isNew(int id) {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java
index e62eff496..6c385672a 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java
@@ -40,15 +40,15 @@ abstract class PathConstraint implements FSMatchConstraint {
@Override
public String toString() {
- if (this.featNames == null) {
+ if (featNames == null) {
return "";
}
StringBuffer buf = new StringBuffer();
- for (int i = 0; i < this.featNames.size(); i++) {
+ for (int i = 0; i < featNames.size(); i++) {
if (i > 0) {
buf.append('.');
}
- buf.append(this.featNames.get(i));
+ buf.append(featNames.get(i));
}
return buf.toString();
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
index 77ff9bb07..8850e3f4f 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
@@ -151,8 +151,8 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
************************************************/
//@formatter:on
public SelectFSs_impl(CAS cas) {
- this.view = (CASImpl) cas.getLowLevelCAS();
- this.jcas = (JCasImpl) view.getJCas();
+ view = (CASImpl) cas.getLowLevelCAS();
+ jcas = (JCasImpl) view.getJCas();
}
public SelectFSs_impl(FSArray source) {
@@ -184,12 +184,12 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
* @return -
*/
public SelectFSs_impl<T> index(String indexName) {
- this.index = view.indexRepository.getIndex(indexName);
+ index = view.indexRepository.getIndex(indexName);
return this;
}
public SelectFSs_impl<T> index(FSIndex<T> aIndex) {
- this.index = (LowLevelIndex<T>) aIndex;
+ index = (LowLevelIndex<T>) aIndex;
return this;
}
@@ -197,7 +197,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
* Select the index's uppermost type.
*/
public <N extends T> SelectFSs_impl<N> anyType() {
- this.ti = (TypeImpl) null;
+ ti = (TypeImpl) null;
return (SelectFSs_impl<N>) this;
}
@@ -213,7 +213,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
}
}
- this.ti = (TypeImpl) uimaType;
+ ti = (TypeImpl) uimaType;
return (SelectFSs_impl<N>) this;
}
@@ -227,12 +227,12 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
throw new IllegalArgumentException("Undefined type: [" + fullyQualifiedTypeName + "]");
}
- this.ti = type;
+ ti = type;
return (SelectFSs_impl<N>) this;
}
public <N extends T> SelectFSs_impl<N> type(int jcasClass_dot_type) {
- this.ti = (TypeImpl) view.getJCas().getCasType(jcasClass_dot_type);
+ ti = (TypeImpl) view.getJCas().getCasType(jcasClass_dot_type);
return (SelectFSs_impl<N>) this;
}
@@ -240,7 +240,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
if (jcasClass_dot_class == null) {
throw new IllegalArgumentException("Must specify a type");
}
- this.ti = (TypeImpl) view.getJCasImpl().getCasType(jcasClass_dot_class);
+ ti = (TypeImpl) view.getJCasImpl().getCasType(jcasClass_dot_class);
return (SelectFSs_impl<N>) this;
}
@@ -251,7 +251,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
*/
@Override
public SelectFSs<T> typePriority() {
- this.isTypePriority = true;
+ isTypePriority = true;
return this;
}
@@ -262,7 +262,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
*/
@Override
public SelectFSs<T> typePriority(boolean aTypePriority) {
- this.isTypePriority = aTypePriority;
+ isTypePriority = aTypePriority;
return this;
}
@@ -301,7 +301,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
*/
@Override
public SelectFSs<T> skipWhenSameBeginEndType() {
- this.isSkipSameBeginEndType = true;
+ isSkipSameBeginEndType = true;
return this;
}
@@ -312,7 +312,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
*/
@Override
public SelectFSs<T> useAnnotationEquals(boolean useAnnotationEquals) {
- this.isSkipSameBeginEndType = useAnnotationEquals;
+ isSkipSameBeginEndType = useAnnotationEquals;
return this;
}
@@ -322,13 +322,13 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> nonOverlapping() { // AI known as unambiguous
- this.isNonOverlapping = true;
+ isNonOverlapping = true;
return this;
}
@Override
public SelectFSs_impl<T> nonOverlapping(boolean bNonOverlapping) { // AI
- this.isNonOverlapping = bNonOverlapping;
+ isNonOverlapping = bNonOverlapping;
return this;
}
@@ -358,49 +358,49 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> allViews() {
- this.isAllViews = true;
+ isAllViews = true;
return this;
}
@Override
public SelectFSs_impl<T> allViews(boolean bAllViews) {
- this.isAllViews = bAllViews;
+ isAllViews = bAllViews;
return this;
}
@Override
public SelectFSs_impl<T> nullOK() { // applies to get() and single()
- this.isNullOK = true;
+ isNullOK = true;
return this;
}
@Override
public SelectFSs_impl<T> nullOK(boolean bNullOk) { // applies to get() and single()
- this.isNullOK = bNullOk;
+ isNullOK = bNullOk;
return this;
}
@Override
public SelectFSs_impl<T> orderNotNeeded() { // ignored if not ordered index
- this.isUnordered = true;
+ isUnordered = true;
return this;
}
@Override
public SelectFSs_impl<T> orderNotNeeded(boolean bUnordered) { // ignored if not ordered index
- this.isUnordered = bUnordered;
+ isUnordered = bUnordered;
return this;
}
@Override
public SelectFSs_impl<T> backwards() { // ignored if not ordered index
- this.isBackwards = true;
+ isBackwards = true;
return this;
}
@Override
public SelectFSs_impl<T> backwards(boolean bBackwards) { // ignored if not ordered index
- this.isBackwards = bBackwards;
+ isBackwards = bBackwards;
return this;
}
@@ -417,19 +417,19 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> shifted(int shiftAmount) {
- this.shift = shiftAmount;
+ shift = shiftAmount;
return this;
}
@Override
public SelectFSs_impl<T> startAt(FeatureStructure fs) {
- this.startingFs = (TOP) fs;
+ startingFs = (TOP) fs;
return this;
}
@Override
public SelectFSs_impl<T> startAt(TOP fs) { // Ordered
- this.startingFs = fs;
+ startingFs = fs;
return this;
}
// @Override
@@ -443,35 +443,35 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> startAt(int begin) {
- this.isTypePriority = false;
- this.startingFs = makePosAnnot(begin, Integer.MAX_VALUE);
+ isTypePriority = false;
+ startingFs = makePosAnnot(begin, Integer.MAX_VALUE);
return this;
}
@Override
public SelectFSs_impl<T> startAt(int begin, int end) { // AI
- this.startingFs = makePosAnnot(begin, end);
+ startingFs = makePosAnnot(begin, end);
return this;
}
@Override
public SelectFSs_impl<T> startAt(TOP fs, int offset) { // Ordered
- this.startingFs = fs;
- this.shift = offset;
+ startingFs = fs;
+ shift = offset;
return this;
}
@Override
public SelectFSs_impl<T> startAt(FeatureStructure fs, int offset) { // Ordered
- this.startingFs = (TOP) fs;
- this.shift = offset;
+ startingFs = (TOP) fs;
+ shift = offset;
return this;
}
@Override
public SelectFSs_impl<T> startAt(int begin, int end, int offset) { // AI
- this.startingFs = makePosAnnot(begin, end);
- this.shift = offset;
+ startingFs = makePosAnnot(begin, end);
+ shift = offset;
return this;
}
@@ -480,7 +480,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
if (alimit < 0) {
throw new IllegalArgumentException("limit argument must be >= 0, but was " + alimit);
}
- this.limit = alimit;
+ limit = alimit;
return this;
}
@@ -490,7 +490,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> coveredBy(AnnotationFS fs) { // AI
boundsUse = BoundsUse.coveredBy;
- this.boundingFs = fs;
+ boundingFs = fs;
// this.isIncludeAnnotWithEndBeyondBounds = false; //default
return this;
}
@@ -498,7 +498,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> coveredBy(int begin, int end) { // AI
boundsUse = BoundsUse.coveredBy;
- this.boundingFs = makePosAnnot(begin, end);
+ boundingFs = makePosAnnot(begin, end);
// this.isIncludeAnnotWithEndBeyondBounds = true; //default
return this;
}
@@ -506,14 +506,14 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public SelectFSs_impl<T> covering(AnnotationFS fs) { // AI
boundsUse = BoundsUse.covering;
- this.boundingFs = fs;
+ boundingFs = fs;
return this;
}
@Override
public SelectFSs_impl<T> covering(int begin, int end) { // AI
boundsUse = BoundsUse.covering;
- this.boundingFs = makePosAnnot(begin, end);
+ boundingFs = makePosAnnot(begin, end);
return this;
}
@@ -1187,19 +1187,19 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public T get(int offset) {
- this.shift = offset;
+ shift = offset;
return getNullChk();
}
@Override
public T single(int offset) {
- this.shift = offset;
+ shift = offset;
return single();
}
@Override
public T singleOrNull(int offset) {
- this.shift = offset;
+ shift = offset;
return singleOrNull();
}
@@ -1518,16 +1518,16 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
// }
private SelectFSs<T> commonFollowing(Annotation annotation, int offset) {
- this.startingFs = annotation;
- this.shift = offset;
+ startingFs = annotation;
+ shift = offset;
isFollowing = true;
return this;
}
private SelectFSs<T> commonPreceding(Annotation annotation, int offset) {
// validateSinglePosition(fs, offset);
- this.startingFs = annotation;
- this.shift = offset;
+ startingFs = annotation;
+ shift = offset;
isPreceding = true;
return this;
}
@@ -1748,7 +1748,7 @@ public class SelectFSs_impl<T extends FeatureStructure> implements SelectFSs<T>
@Override
public boolean isEmpty() {
- if (this.limit == 0) {
+ if (limit == 0) {
return true;
}
return fsIterator().size() == 0;
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/ShortHeap.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/ShortHeap.java
index 94cb95522..49e9f1942 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/ShortHeap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/ShortHeap.java
@@ -38,17 +38,17 @@ final class ShortHeap extends CommonAuxHeap {
@Override
void initMemory() {
- this.heap = new short[this.heapBaseSize];
+ heap = new short[heapBaseSize];
}
@Override
void initMemory(int size) {
- this.heap = new short[size];
+ heap = new short[size];
}
@Override
int getCapacity() {
- return this.heap.length;
+ return heap.length;
}
@Override
@@ -64,12 +64,12 @@ final class ShortHeap extends CommonAuxHeap {
@Override
void resetToZeros() {
- Arrays.fill(this.heap, 0, this.heapPos, (short) NULL);
+ Arrays.fill(heap, 0, heapPos, (short) NULL);
}
// Getters
short getHeapValue(int offset) {
- return this.heap[offset];
+ return heap[offset];
}
// setters
@@ -95,7 +95,7 @@ final class ShortHeap extends CommonAuxHeap {
heap = new short[argLength];
System.arraycopy(shortHeap, 0, heap, 0, argLength);
- this.heapPos = argLength;
+ heapPos = argLength;
}
public short[] toArray() {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java
index 852d743e3..2bd80ed5b 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java
@@ -40,13 +40,13 @@ class StringConstraint extends PathConstraint implements FSMatchConstraint {
StringConstraint(ArrayList<String> path, FSStringConstraint cons) {
super(path);
- this.stringConstraint = cons;
+ stringConstraint = cons;
}
@Override
public boolean match(FeatureStructure fs) {
// compile(((FeatureStructureImpl) fs).getCAS().getTypeSystem());
- final int max = this.featNames.size() - 1; // The last position in the
+ final int max = featNames.size() - 1; // The last position in the
// path!
if (max < 0) {
// If the path is empty, we can't get a string, and therefore the
@@ -55,22 +55,22 @@ class StringConstraint extends PathConstraint implements FSMatchConstraint {
}
Feature feat;
for (int i = 0; i < max; i++) {
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(i));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(i));
if (feat == null) {
return false;
}
fs = fs.getFeatureValue(feat);
}
- feat = fs.getType().getFeatureByBaseName(this.featNames.get(max));
+ feat = fs.getType().getFeatureByBaseName(featNames.get(max));
if (feat == null) {
return false;
}
- return this.stringConstraint.match(fs.getStringValue(feat));
+ return stringConstraint.match(fs.getStringValue(feat));
}
@Override
public String toString() {
- return super.toString() + " " + this.stringConstraint.toString();
+ return super.toString() + " " + stringConstraint.toString();
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringHeap.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringHeap.java
index 21b87e7b1..bb6e3b983 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringHeap.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringHeap.java
@@ -41,8 +41,8 @@ final class StringHeap {
// Initialize internal datastructures. This used to be a lot more complicated when we had the
// character heap option.
private void initMemory() {
- this.stringList = new ArrayList<>();
- this.stringList.add(null);
+ stringList = new ArrayList<>();
+ stringList.add(null);
}
/**
@@ -67,7 +67,7 @@ final class StringHeap {
stringLength = shdh.refHeap[i + StringHeapDeserializationHelper.CHAR_HEAP_STRLEN_OFFSET];
String s = charHeapInString.substring(stringOffset, stringOffset + stringLength);
String reuse = reuseStrings.putIfAbsent(s, s);
- this.stringList.add(reuse != null ? reuse : s);
+ stringList.add(reuse != null ? reuse : s);
}
}
@@ -83,13 +83,13 @@ final class StringHeap {
StringHeapDeserializationHelper serialize(int startPos) {
StringHeapDeserializationHelper shdh = new StringHeapDeserializationHelper();
// Ref heap is 3 times the size of the string list.
- shdh.refHeap = new int[(this.stringList.size() - startPos + 1)
+ shdh.refHeap = new int[(stringList.size() - startPos + 1)
* StringHeapDeserializationHelper.REF_HEAP_CELL_SIZE];
shdh.refHeapPos = shdh.refHeap.length;
// Compute required size of character heap.
int charHeapSize = 0;
- for (int i = startPos; i < this.stringList.size(); i++) {
- String s = this.stringList.get(i);
+ for (int i = startPos; i < stringList.size(); i++) {
+ String s = stringList.get(i);
if (s != null) {
charHeapSize += s.length();
}
@@ -100,8 +100,8 @@ final class StringHeap {
int charCount = 0;
// Now write out the actual data
int r = 1;
- for (int i = startPos; i < this.stringList.size(); i++) {
- String s = this.stringList.get(i);
+ for (int i = startPos; i < stringList.size(); i++) {
+ String s = stringList.get(i);
int refHeapOffset = r * StringHeapDeserializationHelper.REF_HEAP_CELL_SIZE;
shdh.refHeap[refHeapOffset
+ StringHeapDeserializationHelper.CHAR_HEAP_POINTER_OFFSET] = charCount;
@@ -125,12 +125,12 @@ final class StringHeap {
if (stringCode == LowLevelCAS.NULL_FS_REF) {
return null;
}
- return this.stringList.get(stringCode);
+ return stringList.get(stringCode);
}
// Who uses this?
int copyCharsToBuffer(int stringCode, char[] buffer, int start) {
- final String str = this.stringList.get(stringCode);
+ final String str = stringList.get(stringCode);
final int len = str.length();
final int requestedMax = start + len;
// Check that the buffer is long enough to copy the whole string. If it isn't long enough, we
@@ -153,8 +153,8 @@ final class StringHeap {
if (s == null) {
return LowLevelCAS.NULL_FS_REF;
}
- final int addr = this.stringList.size();
- this.stringList.add(s);
+ final int addr = stringList.size();
+ stringList.add(s);
return addr;
}
@@ -166,11 +166,11 @@ final class StringHeap {
// Who uses this?
int addCharBuffer(char[] buffer, int start, int length) {
String s = new String(buffer, start, length);
- return this.addString(s);
+ return addString(s);
}
int getCharArrayLength(int stringCode) {
- return this.stringList.get(stringCode).length();
+ return stringList.get(stringCode).length();
}
int getLeastStringCode() {
@@ -178,11 +178,11 @@ final class StringHeap {
}
int getLargestStringCode() {
- return this.stringList.size() - 1;
+ return stringList.size() - 1;
}
int getSize() {
- return this.stringList.size();
+ return stringList.size();
}
public String[] toArray() {
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringSet.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringSet.java
index 21f875483..2967584ef 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringSet.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringSet.java
@@ -75,7 +75,7 @@ final class StringSet {
}
int getSize() {
- return this.strings.size();
+ return strings.size();
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
index 63c55673f..13dfb682e 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
@@ -293,24 +293,24 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
this.originalBoundingAnnotation = (Annotation) ((originalBoundingAnnotation != null)
? originalBoundingAnnotation
: boundingAnnot);
- this.isBounded = boundsUse != null && boundsUse != BoundsUse.notBounded;
+ isBounded = boundsUse != null && boundsUse != BoundsUse.notBounded;
this.boundsUse = (boundsUse == null) ? BoundsUse.notBounded : boundsUse;
if (isBounded && (null == boundingAnnot || !(boundingAnnot instanceof Annotation))) {
Misc.internalError(
new IllegalArgumentException("Bounded Subiterators require a bounding annotation"));
}
- this.boundBegin = isBounded ? this.boundingAnnot.getBegin() : -1;
- this.boundEnd = isBounded ? this.boundingAnnot.getEnd() : -1;
- this.boundType = isBounded ? (TypeImpl) this.originalBoundingAnnotation.getType() : null;
- this.originalBoundBegin = isBounded ? this.originalBoundingAnnotation.getBegin() : -1;
- this.originalBoundEnd = isBounded ? this.originalBoundingAnnotation.getEnd() : -1;
+ boundBegin = isBounded ? this.boundingAnnot.getBegin() : -1;
+ boundEnd = isBounded ? this.boundingAnnot.getEnd() : -1;
+ boundType = isBounded ? (TypeImpl) this.originalBoundingAnnotation.getType() : null;
+ originalBoundBegin = isBounded ? this.originalBoundingAnnotation.getBegin() : -1;
+ originalBoundEnd = isBounded ? this.originalBoundingAnnotation.getEnd() : -1;
- this.isIncludesAnnotationsStartingAtEndPosition = isNonStrictIncludesAnnotationsStartingAtEndPosition;
+ isIncludesAnnotationsStartingAtEndPosition = isNonStrictIncludesAnnotationsStartingAtEndPosition;
this.isIncludeZeroWidthAtBegin = isIncludeZeroWidthAtBegin;
this.isIncludeZeroWidthAtEnd = isIncludeZeroWidthAtEnd;
- this.isUnambiguous = !ambiguous;
- if (this.isUnambiguous) {
+ isUnambiguous = !ambiguous;
+ if (isUnambiguous) {
switch (this.boundsUse) {
case notBounded: // ok
case coveredBy: // ok
@@ -327,7 +327,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
+ " is only allowed for coveredBy subiterator specification");
}
}
- this.isStrict = strict;
+ isStrict = strict;
this.isSkipSameBeginEndType = isSkipSameBeginEndType;
FSIndexRepositoryImpl ir = this.it.ll_getIndex().getCasImpl().indexRepository;
@@ -341,11 +341,11 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
this.isUseTypePriority = isUseTypePriority;
lto = isUseTypePriority ? ir.getDefaultTypeOrder() : null;
- this.comparatorMaybeNoTypeWithoutId = ir.getAnnotationFsComparator(FSComparators.WITHOUT_ID,
+ comparatorMaybeNoTypeWithoutId = ir.getAnnotationFsComparator(FSComparators.WITHOUT_ID,
isUseTypePriority ? FSComparators.WITH_TYPE_ORDER : FSComparators.WITHOUT_TYPE_ORDER);
- this.annotationComparator_withId = ir.getAnnotationFsComparatorWithId();
+ annotationComparator_withId = ir.getAnnotationFsComparatorWithId();
- this.jcas = (JCasImpl) ll_getIndex().getCasImpl().getJCas();
+ jcas = (JCasImpl) ll_getIndex().getCasImpl().getJCas();
isDoEqualsTest = (boundsUse == coveredBy || boundsUse == sameBeginEnd || boundsUse == covering)
&& this.originalBoundingAnnotation._inSetSortedIndex();
@@ -413,28 +413,28 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
boolean isIncludeZeroWidthAtBegin, boolean isIncludeZeroWidthAtEnd) {
this.it = (LowLevelIterator<Annotation>) it;
- this.isIncludesAnnotationsStartingAtEndPosition = isStrictIncludesAnnotationsStartingAtEndPosition;
+ isIncludesAnnotationsStartingAtEndPosition = isStrictIncludesAnnotationsStartingAtEndPosition;
this.isIncludeZeroWidthAtBegin = isIncludeZeroWidthAtBegin;
this.isIncludeZeroWidthAtEnd = isIncludeZeroWidthAtEnd;
this.boundingAnnot = boundingAnnot; // could be same begin/end, coveredby, or covering
this.originalBoundingAnnotation = originalBoundingAnnotation;
- this.isBounded = boundsUse != null && boundsUse != BoundsUse.notBounded;
+ isBounded = boundsUse != null && boundsUse != BoundsUse.notBounded;
this.boundsUse = (boundsUse == null) ? BoundsUse.notBounded : boundsUse;
- this.isUnambiguous = !ambiguous;
+ isUnambiguous = !ambiguous;
if (strict) {
if (BoundsUse.coveredBy != boundsUse && BoundsUse.sameBeginEnd != boundsUse) {
throw new IllegalArgumentException(
"Strict requires BoundsUse.coveredBy or BoundsUse.sameBeginEnd");
}
}
- this.isStrict = strict;
+ isStrict = strict;
this.isSkipSameBeginEndType = isSkipSameBeginEndType;
- this.boundBegin = isBounded ? boundingAnnot.getBegin() : -1;
- this.boundEnd = isBounded ? boundingAnnot.getEnd() : -1;
- this.boundType = isBounded ? (TypeImpl) originalBoundingAnnotation.getType() : null;
- this.originalBoundBegin = isBounded ? this.originalBoundingAnnotation.getBegin() : -1;
- this.originalBoundEnd = isBounded ? this.originalBoundingAnnotation.getEnd() : -1;
+ boundBegin = isBounded ? boundingAnnot.getBegin() : -1;
+ boundEnd = isBounded ? boundingAnnot.getEnd() : -1;
+ boundType = isBounded ? (TypeImpl) originalBoundingAnnotation.getType() : null;
+ originalBoundBegin = isBounded ? this.originalBoundingAnnotation.getBegin() : -1;
+ originalBoundEnd = isBounded ? this.originalBoundingAnnotation.getEnd() : -1;
FSIndexRepositoryImpl ir = this.it.ll_getIndex().getCasImpl().indexRepository;
// underlying_iterator_using_typepriorities = ir.isAnnotationComparator_usesTypeOrder();
@@ -442,11 +442,11 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
this.isUseTypePriority = isUseTypePriority;
lto = isUseTypePriority ? ir.getDefaultTypeOrder() : null;
- this.comparatorMaybeNoTypeWithoutId = ir.getAnnotationFsComparator(FSComparators.WITHOUT_ID,
+ comparatorMaybeNoTypeWithoutId = ir.getAnnotationFsComparator(FSComparators.WITHOUT_ID,
isUseTypePriority ? FSComparators.WITH_TYPE_ORDER : FSComparators.WITHOUT_TYPE_ORDER);
- this.annotationComparator_withId = ir.getAnnotationFsComparatorWithId();
+ annotationComparator_withId = ir.getAnnotationFsComparatorWithId();
- this.jcas = (JCasImpl) ll_getIndex().getCasImpl().getJCas();
+ jcas = (JCasImpl) ll_getIndex().getCasImpl().getJCas();
this.coveringStartPos = coveringStartPos;
this.startId = startId;
@@ -469,13 +469,13 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
// moves to the start annotation, including moving past equals for annot style,
// and accommodating strict
moveToStart();
- this.list = new ArrayList<>();
+ list = new ArrayList<>();
while (isValid()) {
list.add(it.getNvc());
// does all the adjustments, so list has only appropriate elements
moveToNextNvc();
}
- this.pos = 0;
+ pos = 0;
// do at end, so up to this point, iterator is not the list form style
isListForm = true;
}
@@ -512,7 +512,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
@Override
public boolean isValid() {
if (isListForm) {
- return (this.pos >= 0) && (this.pos < this.list.size());
+ return (pos >= 0) && (pos < list.size());
}
// assume all non-list form movements leave the underlying iterator
// positioned either as invalid, or at the valid spot including the bounds, for
@@ -524,7 +524,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
@Override
public T getNvc() {
if (isListForm) {
- return (T) this.list.get(this.pos);
+ return (T) list.get(pos);
} else {
return (T) it.getNvc();
}
@@ -534,7 +534,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
public void moveToNextNvc() {
// no isValid check because caller checked: "Nvc"
if (isListForm) {
- ++this.pos;
+ ++pos;
// maybeSetPrevEnd not needed because list form already accounted for unambiguous
return;
}
@@ -610,7 +610,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
public void moveToPreviousNvc() {
// no isValid check because caller checked: "Nvc"
if (isListForm) {
- --this.pos;
+ --pos;
return;
}
@@ -618,8 +618,8 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
// Convert to list form
Annotation currentAnnotation = it.getNvc(); // save to restore position
convertToListForm();
- pos = Collections.binarySearch(this.list, currentAnnotation, annotationComparator_withId);
- --this.pos;
+ pos = Collections.binarySearch(list, currentAnnotation, annotationComparator_withId);
+ --pos;
return;
}
@@ -637,7 +637,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
}
if (isListForm) {
- this.pos = 0;
+ pos = 0;
} else {
moveToStart();
}
@@ -671,7 +671,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
}
if (isListForm) {
- this.pos = this.list.size() - 1;
+ pos = list.size() - 1;
} else {
switch (boundsUse) {
@@ -842,7 +842,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
// Don't need strict, skip-over-boundary, or type priority adjustments,
// because these were done when the list form was created
// Want to move to leftmost
- pos = Collections.binarySearch(this.list, fsa, comparatorMaybeNoTypeWithoutId);
+ pos = Collections.binarySearch(list, fsa, comparatorMaybeNoTypeWithoutId);
// int begin = fsa.getBegin();
// int end = fsa.getEnd();
// Type type = fsa.getType();
@@ -928,7 +928,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
// find equal match and position to left most of the equal, including types, or
// not find equal match and position to next greater one, which won't match next test
if (is_beyond_bounds_chk_sameBeginEnd()) {
- this.isEmpty = true; // iterator was made invalid
+ isEmpty = true; // iterator was made invalid
return;
}
// skip over bounding annotation
@@ -996,7 +996,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
private boolean is_beyond_bounds_chk_sameBeginEndNvc() {
Annotation a = it.getNvc();
- if (a.getBegin() != this.boundBegin || a.getEnd() != this.boundEnd
+ if (a.getBegin() != boundBegin || a.getEnd() != boundEnd
|| (isUseTypePriority && a._getTypeImpl() != boundType)) {
makeInvalid();
return true;
@@ -1042,7 +1042,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
int begin = a.getBegin();
int end = a.getEnd();
- if (begin > this.boundBegin || (begin == this.boundBegin && (end < boundEnd
+ if (begin > boundBegin || (begin == boundBegin && (end < boundEnd
|| (end == boundEnd && lto != null && lto.lessThan(a._getTypeImpl(), boundType))))) {
makeInvalid();
return true;
@@ -1186,8 +1186,8 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
private void maybeSetPrevBounds() {
if (isUnambiguous && it.isValid()) {
Annotation a = it.getNvc();
- this.prevBegin = a.getBegin();
- this.prevEnd = a.getEnd();
+ prevBegin = a.getBegin();
+ prevEnd = a.getEnd();
}
}
@@ -1223,7 +1223,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
return true;
}
- while ((item.getBegin() == this.boundEnd && item.getBegin() < item.getEnd())
+ while ((item.getBegin() == boundEnd && item.getBegin() < item.getEnd())
|| equalToBounds(item) || (isUnambiguous && overlapping(item, prevBegin, prevEnd))) {
it.moveToNextNvc();
if (!isValid()) {
@@ -1231,7 +1231,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
}
item = it.getNvc();
- if (item.getBegin() > this.boundEnd) { // not >= because could of 0 length annot at end
+ if (item.getBegin() > boundEnd) { // not >= because could of 0 length annot at end
makeInvalid();
return false;
}
@@ -1239,7 +1239,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
return true;
}
- while (item.getEnd() > this.boundEnd || equalToBounds(item)
+ while (item.getEnd() > boundEnd || equalToBounds(item)
|| (isUnambiguous && overlapping(item, prevBegin, prevEnd)) ||
// Item is zero-width at end
(!isIncludeZeroWidthAtEnd && boundEnd == item.getBegin()
@@ -1254,7 +1254,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
}
item = it.getNvc();
- if (item.getBegin() > this.boundEnd) { // not >= because could of 0 length annot at end
+ if (item.getBegin() > boundEnd) { // not >= because could of 0 length annot at end
makeInvalid();
return false;
}
@@ -1299,7 +1299,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
// moveTo may move to invalid position
// if the cur pos item has a begin beyond the bound, it cannot be a covering annotation
- if (begin > this.boundBegin) {
+ if (begin > boundBegin) {
makeInvalid();
return;
}
@@ -1309,9 +1309,9 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
// skip until get an FS whose end >= boundEnd, it is a candidate.
// stop if begin gets too large (going forwards)
// while test: is true if need to move to skip over a too-small "end"
- while (it.isValid() && (equalToBounds(a = it.getNvc()) || (a.getBegin()) <= this.boundBegin
- && ((end = a.getEnd()) < this.boundEnd || (end == this.boundEnd && lto != null
- && lto.lessThan(a._getTypeImpl(), this.boundType))))) {
+ while (it.isValid() && (equalToBounds(a = it.getNvc()) || (a.getBegin()) <= boundBegin
+ && ((end = a.getEnd()) < boundEnd || (end == boundEnd && lto != null
+ && lto.lessThan(a._getTypeImpl(), boundType))))) {
it.moveToNextNvc();
}
}
@@ -1333,16 +1333,16 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
*/
@Override
public FSIterator<T> copy() {
- Subiterator<T> copy = new Subiterator<>(this.it.copy(), this.boundingAnnot,
- this.originalBoundingAnnotation, !this.isUnambiguous, this.isStrict, this.boundsUse,
- this.isUseTypePriority, this.isSkipSameBeginEndType,
-
- this.startId, this.isEmpty, this.coveringStartPos, this.isDoEqualsTest,
- this.isIncludesAnnotationsStartingAtEndPosition, this.isIncludeZeroWidthAtBegin,
- this.isIncludeZeroWidthAtEnd);
- copy.list = this.list; // non-final things
- copy.pos = this.pos;
- copy.isListForm = this.isListForm;
+ Subiterator<T> copy = new Subiterator<>(it.copy(), boundingAnnot,
+ originalBoundingAnnotation, !isUnambiguous, isStrict, boundsUse,
+ isUseTypePriority, isSkipSameBeginEndType,
+
+ startId, isEmpty, coveringStartPos, isDoEqualsTest,
+ isIncludesAnnotationsStartingAtEndPosition, isIncludeZeroWidthAtBegin,
+ isIncludeZeroWidthAtEnd);
+ copy.list = list; // non-final things
+ copy.pos = pos;
+ copy.isListForm = isListForm;
return copy;
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
index b5b6b539c..56ee85e25 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
@@ -178,26 +178,26 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
// FeatureImpl featUimaUID = null; // null or the feature named uimaUID with range type long
private TypeImpl() {
- this.name = null;
- this.shortName = null;
- this.jcasClassName = null;
- this.superType = null;
-
- this.isInheritanceFinal = false;
- this.isFeatureFinal = false;
- this.isLongOrDouble = false;
- this.isCreatableAndNotBuiltinArray = false;
- this.tsi = null;
- this.typeCode = 0;
-
- this.isRefType = false;
- this.javaClass = null;
+ name = null;
+ shortName = null;
+ jcasClassName = null;
+ superType = null;
+
+ isInheritanceFinal = false;
+ isFeatureFinal = false;
+ isLongOrDouble = false;
+ isCreatableAndNotBuiltinArray = false;
+ tsi = null;
+ typeCode = 0;
+
+ isRefType = false;
+ javaClass = null;
// getter_funct_intfc_class = null;
// setter_funct_intfc_class = null;
slotKind = TypeSystemImpl.getSlotKindFromType(this);
- this.allSuperTypes = null;
- this.hashCodeNameLong = Misc.hashStringLong(name);
+ allSuperTypes = null;
+ hashCodeNameLong = Misc.hashStringLong(name);
}
/**
@@ -215,19 +215,19 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
}
this.name = name;
- this.jcasClassName = Misc.typeName2ClassName(name);
+ jcasClassName = Misc.typeName2ClassName(name);
final int pos = this.name.lastIndexOf(TypeSystem.NAMESPACE_SEPARATOR);
- this.shortName = (pos >= 0) ? this.name.substring(pos + 1) : name;
- this.superType = supertype;
+ shortName = (pos >= 0) ? this.name.substring(pos + 1) : name;
+ superType = supertype;
- this.isInheritanceFinal = false;
- this.isFeatureFinal = false;
- this.isLongOrDouble = name.equals(CAS.TYPE_NAME_LONG) || name.equals(CAS.TYPE_NAME_DOUBLE);
+ isInheritanceFinal = false;
+ isFeatureFinal = false;
+ isLongOrDouble = name.equals(CAS.TYPE_NAME_LONG) || name.equals(CAS.TYPE_NAME_DOUBLE);
this.tsi = tsi;
if (tsi.types.size() > Short.MAX_VALUE) {
throw new RuntimeException("Too many types declared, max is 32767.");
}
- this.typeCode = (short) tsi.types.size(); // initialized with one null; so first typeCode == 1
+ typeCode = (short) tsi.types.size(); // initialized with one null; so first typeCode == 1
tsi.types.add(this);
TypeImpl node = supertype;
@@ -238,7 +238,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
}
allSuperTypes = a.toArray(new TypeImpl[a.size()]);
- if (null != this.superType) { // top has null super
+ if (null != superType) { // top has null super
// if (!superType.isArray()) {
// this because we have from V2: xyz[] is a subtype of FSArray, but FSArray doesn't list it as
// a direct subtype
@@ -249,13 +249,13 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
staticMergedFeatures.putAll(superType.staticMergedFeatures);
}
}
- this.isCreatableAndNotBuiltinArray =
+ isCreatableAndNotBuiltinArray =
// until stringType is set, skip this part of the test
(tsi.stringType == null || supertype != tsi.stringType) // string subtypes aren't FSs,
// they are only values
&& !BuiltinTypeKinds.nonCreatableTypesAndBuiltinArrays_contains(name);
- this.isRefType = tsi.classifyAsRefType(name, supertype);
+ isRefType = tsi.classifyAsRefType(name, supertype);
this.javaClass = javaClass;
tsi.typeName2TypeImpl.put(name, this);
@@ -289,7 +289,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
hasRefFeature = name.equals(CAS.TYPE_NAME_FS_ARRAY); // initialization of other cases done at
// commit time
- this.hashCodeNameLong = Misc.hashStringLong(name);
+ hashCodeNameLong = Misc.hashStringLong(name);
}
/**
@@ -299,11 +299,11 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
*/
@Override
public String getName() {
- return this.name;
+ return name;
}
public String getJCasClassName() {
- return this.jcasClassName;
+ return jcasClassName;
}
/**
@@ -312,7 +312,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
* @return The super type or null for Top.
*/
public TypeImpl getSuperType() {
- return this.superType;
+ return superType;
}
/**
@@ -322,7 +322,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
* @return The internal code for this type, <code>>=0</code>.
*/
public int getCode() {
- return this.typeCode;
+ return typeCode;
}
@Override
@@ -435,7 +435,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
* @return The type hierarchy.
*/
public TypeSystemImpl getTypeSystem() {
- return this.tsi;
+ return tsi;
}
/**
@@ -451,7 +451,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
*/
@Override
public String getShortName() {
- return this.shortName;
+ return shortName;
}
/**
@@ -459,7 +459,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
*/
@Override
public boolean isFeatureFinal() {
- return this.isFeatureFinal;
+ return isFeatureFinal;
}
/**
@@ -467,23 +467,23 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
*/
@Override
public boolean isInheritanceFinal() {
- return this.isInheritanceFinal;
+ return isInheritanceFinal;
}
void setFeatureFinal() {
- this.isFeatureFinal = true;
+ isFeatureFinal = true;
}
void setInheritanceFinal() {
- this.isInheritanceFinal = true;
+ isInheritanceFinal = true;
}
void setBuiltIn() {
- this.isBuiltIn = true;
+ isBuiltIn = true;
}
public boolean isLongOrDouble() {
- return this.isLongOrDouble;
+ return isLongOrDouble;
}
/**
@@ -639,7 +639,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
* been defined on (super)type "{3}" with range "{4}".
*/
throw new CASAdminException(CASAdminException.DUPLICATE_FEATURE, existingFi.getShortName(),
- this.getName(), range.getName(), existingFi.getDomain().getName(),
+ getName(), range.getName(), existingFi.getDomain().getName(),
existingFi.getRange().getName());
}
}
@@ -866,11 +866,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
return true;
}
- if (depthFirstNextSibling != 0) { // means that these codes are valid
- return false;
- }
-
- if (this.equals(ti)) {
+ if ((depthFirstNextSibling != 0) || equals(ti)) {
return false;
}
@@ -994,8 +990,8 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
private long hashCodeLong() {
if (!hasHashCodeLong) {
synchronized (this) {
- this.hashCodeLong = computeHashCodeLong();
- if (this.getTypeSystem().isCommitted()) {
+ hashCodeLong = computeHashCodeLong();
+ if (getTypeSystem().isCommitted()) {
hasHashCodeLong = true; // no need to recompute
}
}
@@ -1081,7 +1077,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
if (this == t)
return 0;
- long hcl = this.hashCodeLong();
+ long hcl = hashCodeLong();
long thcl = t.hashCodeLong();
if (hcl == thcl)
return 0;
@@ -1092,23 +1088,23 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
if (c != 0)
return c;
- if (this.superType == null || t.superType == null) {
+ if (superType == null || t.superType == null) {
throw Misc.internalError();
}
;
- c = Long.compare(this.superType.hashCodeNameLong, t.superType.hashCodeNameLong);
+ c = Long.compare(superType.hashCodeNameLong, t.superType.hashCodeNameLong);
if (c != 0)
return c;
- c = Integer.compare(this.getNumberOfFeatures(), t.getNumberOfFeatures());
+ c = Integer.compare(getNumberOfFeatures(), t.getNumberOfFeatures());
if (c != 0)
return c;
- c = Boolean.compare(this.isFeatureFinal, t.isFeatureFinal);
+ c = Boolean.compare(isFeatureFinal, t.isFeatureFinal);
if (c != 0)
return c;
- c = Boolean.compare(this.isInheritanceFinal, t.isInheritanceFinal);
+ c = Boolean.compare(isInheritanceFinal, t.isInheritanceFinal);
if (c != 0)
return c;
@@ -1134,7 +1130,7 @@ public class TypeImpl implements Type, Comparable<TypeImpl> {
return false;
}
- switch (this.typeCode) {
+ switch (typeCode) {
case TypeSystemConstants.floatArrayTypeCode:
case TypeSystemConstants.intArrayTypeCode:
case TypeSystemConstants.booleanArrayTypeCode:
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java
index 7812362fb..2d76cefc0 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java
@@ -35,8 +35,8 @@ public class TypeImpl_array extends TypeImpl implements TypeSystemConstants {
public TypeImpl_array(String name, TypeImpl componentType, TypeSystemImpl tsi, TypeImpl supertype,
SlotKind componentSlotKind, boolean isHeapStoredArray, Class<?> javaClass) {
super(name, tsi, supertype, javaClass);
- this.isInheritanceFinal = true;
- this.isFeatureFinal = true;
+ isInheritanceFinal = true;
+ isFeatureFinal = true;
this.componentType = componentType;
this.isHeapStoredArray = isHeapStoredArray;
this.componentSlotKind = componentSlotKind;
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java
index 81cf09093..b01540e8d 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java
@@ -40,7 +40,7 @@ public class TypeImpl_string extends TypeImpl_primitive { // string considered a
@Override
public boolean subsumes(TypeImpl ti) {
- if (this.isStringSubtype()) {
+ if (isStringSubtype()) {
return this == ti; // a string subtype only can subsume itself
}
return ti.isStringOrStringSubtype();
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeNameSpaceImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeNameSpaceImpl.java
index b3d47943f..31afd8976 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeNameSpaceImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeNameSpaceImpl.java
@@ -42,7 +42,7 @@ public class TypeNameSpaceImpl implements TypeNameSpace {
*/
@Override
public Type getType(String typeName) {
- return this.ts.getType(this.name + TypeSystem.NAMESPACE_SEPARATOR + typeName);
+ return ts.getType(name + TypeSystem.NAMESPACE_SEPARATOR + typeName);
}
}
diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
index aa9fe7ebf..d50c26962 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
@@ -907,7 +907,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
if (typeName.endsWith(ARRAY_TYPE_SUFFIX)) {
checkTypeSyntax(typeName.substring(0, typeName.length() - 2));
} else {
- if (this.locked) {
+ if (locked) {
throw new CASAdminException(CASAdminException.TYPE_SYSTEM_LOCKED);
}
@@ -919,7 +919,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
}
void newTypeCheckNoInheritanceFinalCheck(String typeName, Type superType) {
- if (this.locked) {
+ if (locked) {
throw new CASAdminException(CASAdminException.TYPE_SYSTEM_LOCKED);
}
checkTypeSyntax(typeName);
@@ -990,7 +990,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
public Feature addFeature(String shortFeatName, Type domainType, Type rangeType,
boolean multipleReferencesAllowed) throws CASAdminException {
- if (this.locked) {
+ if (locked) {
throw new CASAdminException(CASAdminException.TYPE_SYSTEM_LOCKED);
}
@@ -1070,11 +1070,11 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
*/
@Override
public TypeImpl getTopType() {
- return this.topType;
+ return topType;
}
public TypeImpl getTopTypeImpl() {
- return this.topType;
+ return topType;
}
/**
@@ -1205,11 +1205,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
// committed
}
- if (subType == fsArrayType) {
- return superType == topType || superType == arrayBaseType;
- }
-
- if (subType.isArray()) {
+ if ((subType == fsArrayType) || subType.isArray()) {
// If the subtype is an array, and the supertype is not, then the
// supertype must be top, or the abstract array base.
return ((superType == topType) || (superType == arrayBaseType));
@@ -1355,7 +1351,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
* @return true if first argument subsumes the second
*/
public boolean subsumes(int superType, int type) {
- return this.ll_subsumes(superType, type);
+ return ll_subsumes(superType, type);
}
// private void updateSubsumption(int type, int superType) {
@@ -1419,7 +1415,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
@Override
public TypeSystemImpl commit(ClassLoader cl) {
synchronized (this) {
- if (this.locked) {
+ if (locked) {
// is a no-op if already loaded for this Class Loader
// otherwise, need to load and set up generators for this class loader
getGeneratorsForClassLoader(cl, false); // false - is not pear
@@ -1454,7 +1450,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
if (IS_TRACE_JCAS_EXPAND) {
if (this == maybeConsolidatedTypesystem) {
System.out.format("debug type system impl commited new type system and loaded JCas %d%n",
- this.hashCode());
+ hashCode());
System.out.println(Misc.getCallers(1, 50).toString());
} else {
System.out.format(
@@ -1496,7 +1492,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
// fsClassRegistry = new FSClassRegistry(this, true);
// FSClassRegistry.loadAtTypeSystemCommitTime(this, true, cl);
- this.locked = true;
+ locked = true;
return this;
}
@@ -1626,7 +1622,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
String superClassName = superClass.getName();
String uimaSuperTypeName = Misc.javaClassName2UimaTypeName(superClassName);
- if (this.getType(uimaSuperTypeName) != null) {
+ if (getType(uimaSuperTypeName) != null) {
// ****************************
// STOP if get to UIMA type *
@@ -1636,7 +1632,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
// then return to recursively process other jcas class levels.
String className = clazz.getName();
String uimaTypeName = Misc.javaClassName2UimaTypeName(className);
- TypeImpl ti = this.getType(uimaTypeName);
+ TypeImpl ti = getType(uimaTypeName);
if (ti != null) {
maybeAddJCasOffsets(ti, tempIntFis, tempRefFis, tempNsrFis);
}
@@ -1790,7 +1786,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
*/
@Override
public boolean isCommitted() {
- return this.locked;
+ return locked;
}
/**
@@ -1884,7 +1880,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
@Override
public Type addStringSubtype(String typeName, String[] stringList) throws CASAdminException {
Set<String> allowedValues = new HashSet<>(Arrays.asList(stringList));
- TypeImpl supertype = this.stringType;
+ TypeImpl supertype = stringType;
// Check type name syntax.
checkTypeSyntax(typeName);
@@ -1934,7 +1930,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
TypeImpl supertype = computeArrayParentFromComponentType(componentType);
TypeImpl_array ti = new TypeImpl_array(arrayTypeName, (TypeImpl) componentType, this, supertype,
slotKind, isHeapStoredArray, javaClass);
- this.arrayComponentTypeToArrayType.put(componentType, ti);
+ arrayComponentTypeToArrayType.put(componentType, ti);
// the reverse - going from array type to component type is done via the getComponentType method
// of TypeImplArray
return ti;
@@ -2294,7 +2290,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
public TypeImpl getTypeForCode(int typeCode) {
if (isType(typeCode)) {
- return this.types.get(typeCode);
+ return types.get(typeCode);
}
return null;
}
@@ -2332,7 +2328,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
}
private final int getLargestFeatureCode() {
- return this.features.size();
+ return features.size();
}
final boolean isFeature(int featureCode) {
@@ -2342,13 +2338,13 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
@Override
public Feature ll_getFeatureForCode(int featureCode) {
if (isFeature(featureCode)) {
- return this.features.get(featureCode);
+ return features.get(featureCode);
}
return null;
}
FeatureImpl getFeatureForCode(int featureCode) {
- return this.features.get(featureCode);
+ return features.get(featureCode);
}
FeatureImpl getFeatureForCode_checked(int featureCode) {
@@ -2541,7 +2537,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
@Override
public Iterator<Feature> getFeatures() {
- List<Feature> lf = Collections.unmodifiableList(this.features);
+ List<Feature> lf = Collections.unmodifiableList(features);
Iterator<Feature> it = lf.iterator();
// The first element is null, so skip it.
it.next();
@@ -2559,7 +2555,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
* @return the domain type for a feature.
*/
public int intro(int feat) {
- return ((TypeImpl) (this.features.get(feat).getDomain())).getCode();
+ return ((TypeImpl) (features.get(feat).getDomain())).getCode();
}
/**
@@ -2570,7 +2566,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
* @return -
*/
public int range(int feat) {
- return ((TypeImpl) (this.features.get(feat).getRange())).getCode();
+ return ((TypeImpl) (features.get(feat).getRange())).getCode();
}
//@formatter:off
@@ -2913,10 +2909,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
TypeSystemImpl other = (TypeSystemImpl) obj;
@@ -3142,7 +3135,7 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
}
public void set_skip_loading_user_jcas(boolean v) {
... 16917 lines suppressed ...