├── .gitignore ├── .idea ├── .name ├── codeStyleSettings.xml ├── compiler.xml ├── copyright │ ├── apache.xml │ └── profiles_settings.xml ├── dictionaries │ └── leventov.xml ├── encodings.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── scopes │ └── scope_settings.xml └── vcs.xml ├── README.md ├── benchmarks ├── build.gradle ├── dimensioned-jmh │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── bench │ │ └── DimensionedJmh.java ├── research │ ├── README.md │ ├── build.gradle │ └── src │ │ └── main │ │ ├── java │ │ ├── com │ │ │ └── koloboke │ │ │ │ └── collect │ │ │ │ └── research │ │ │ │ └── hash │ │ │ │ └── QHashProbes.java │ │ └── net │ │ │ └── openhft │ │ │ └── collections │ │ │ └── research │ │ │ ├── SimpleVanillaShortShortMultiMap.java │ │ │ ├── Tiered1VanillaShortShortMultiMap.java │ │ │ └── Tiered2VanillaShortShortMultiMap.java │ │ └── javaTemplates │ │ ├── com │ │ └── koloboke │ │ │ └── collect │ │ │ ├── impl │ │ │ ├── ParallelVsSeparate.java │ │ │ └── ScalerBenchmarks.java │ │ │ └── research │ │ │ └── hash │ │ │ ├── AddRemoveLookupBenchmarks.java │ │ │ ├── AddRemoveWithTombstonesBenchmarks.java │ │ │ ├── BitStatesLHashCharSet.java │ │ │ ├── ByteAlongStatesDHashCharSet.java │ │ │ ├── ByteAlongStatesLHashCharSet.java │ │ │ ├── ByteStatesDHashCharSet.java │ │ │ ├── ByteStatesLHashCharSet.java │ │ │ ├── CharOps.java │ │ │ ├── ForEachBenchmarks.java │ │ │ ├── LookupBenchmarks.java │ │ │ ├── NoStatesDHashCharSet.java │ │ │ ├── NoStatesLHashCharSet.java │ │ │ ├── NoStatesLSelfAdjHashCharSet.java │ │ │ ├── NoStatesQHashCharSet.java │ │ │ ├── NoStatesRHoodHashCharSet.java │ │ │ ├── NoStatesRHoodSimpleHashCharSet.java │ │ │ ├── ZeroMaskingStatesLHashCharSet.java │ │ │ └── ZeroMaskingStatesQHashCharSet.java │ │ └── net │ │ └── openhft │ │ └── collections │ │ └── research │ │ └── HashPosMapBenchmarks.java └── time-vs-memory │ ├── build.gradle │ └── src │ └── main │ └── javaTemplates │ └── tm │ └── TimeVsMemory.java ├── build.gradle ├── compile ├── README.md ├── eclipse-maven-preferences-apt.png ├── idea-annotation-processor-preferences.png ├── src │ ├── main │ │ └── java │ │ │ ├── com │ │ │ └── koloboke │ │ │ │ └── compile │ │ │ │ ├── ConcurrentModificationUnchecked.java │ │ │ │ ├── CustomKeyEquivalence.java │ │ │ │ ├── KolobokeMap.java │ │ │ │ ├── KolobokeSet.java │ │ │ │ ├── MethodForm.java │ │ │ │ ├── NullKeyAllowed.java │ │ │ │ ├── hash │ │ │ │ └── algo │ │ │ │ │ └── openaddressing │ │ │ │ │ ├── DoubleHashing.java │ │ │ │ │ ├── LinearProbing.java │ │ │ │ │ ├── QuadraticHashing.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── mutability │ │ │ │ ├── Mutable.java │ │ │ │ ├── Updatable.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ └── overview.html │ ├── test │ │ └── java │ │ │ ├── DefaultPackage.java │ │ │ └── com │ │ │ └── koloboke │ │ │ └── compile │ │ │ ├── ArrayParamsMap.java │ │ │ ├── CustomDefaultValueMap.java │ │ │ ├── CustomDefaultValueMapTest.java │ │ │ ├── FloatDoubleMap.java │ │ │ ├── GenericGetParamMap.java │ │ │ ├── IndirectGenericSpecializationMap.java │ │ │ ├── InnerClassParamSet.java │ │ │ ├── InverseParamsMap.java │ │ │ ├── KolobokeMapBackedMultiset.java │ │ │ ├── KolobokeMapBackedMultisetTest.java │ │ │ ├── MyIntLongMap.java │ │ │ ├── MyLongLongMap.java │ │ │ ├── NestedClassKolobokeAnnotatedMap.java │ │ │ ├── OneParamExtendsAnotherMap.java │ │ │ ├── ParamsAreArgsOfActualKeysValuesMap.java │ │ │ ├── ReturnTypeCovarianceMap.java │ │ │ ├── SameKeyAndValueTypeMap.java │ │ │ ├── StaticNestedKeysAndValues.java │ │ │ ├── StaticNestedKeysAndValuesOtherClass.java │ │ │ ├── StringIntMap.java │ │ │ ├── StringIntMapTest.java │ │ │ ├── StringStringMap.java │ │ │ ├── StringVMap.java │ │ │ ├── TParamSet.java │ │ │ ├── TParamSetTest.java │ │ │ ├── ValueParamExtendsKeyParamMap.java │ │ │ └── fromdocs │ │ │ ├── Cache.java │ │ │ ├── CharArrayMap.java │ │ │ ├── ConfigurableKeyEquivalenceMap.java │ │ │ ├── ConfigurableKeyEquivalenceMapTest.java │ │ │ ├── ExtendedMap.java │ │ │ ├── IdentityToIntMap.java │ │ │ ├── IdentityToIntMapTest.java │ │ │ ├── MinusOneDefaultValueObjIntMap.java │ │ │ ├── MinusOneDefaultValueObjIntMapTest.java │ │ │ ├── MyIntLongMap.java │ │ │ ├── MyMap.java │ │ │ ├── MySet.java │ │ │ ├── NonnullKeyMap.java │ │ │ ├── NonnullKeyMapTest.java │ │ │ ├── OptimizedMap.java │ │ │ ├── PositiveNumbersSet.java │ │ │ ├── PositiveNumbersSetTest.java │ │ │ ├── QuadraticHashingMap.java │ │ │ ├── SmallerLongIntMap.java │ │ │ ├── StringIntMap.java │ │ │ ├── SynchronizedMap.java │ │ │ ├── Tickers.java │ │ │ └── TutorialTest.java │ └── testJava8 │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── compile │ │ ├── MyGenericMap.java │ │ └── tests │ │ └── ArrayParamsMapTest.java └── tutorial.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jpsg ├── README.md ├── build.gradle ├── cli │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── jpsg │ │ └── CLI.java ├── core │ ├── build.gradle │ ├── findbugs │ │ └── config │ │ │ └── excludeFilter.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── koloboke │ │ │ └── jpsg │ │ │ ├── ArticleProcessor.java │ │ │ ├── BitsModifierPostProcessor.kt │ │ │ ├── BitsModifierPreProcessor.kt │ │ │ ├── CheckingMatcher.kt │ │ │ ├── CheckingPattern.java │ │ │ ├── Condition.java │ │ │ ├── ConstProcessor.java │ │ │ ├── Context.java │ │ │ ├── DefinitionProcessor.java │ │ │ ├── Dimensions.kt │ │ │ ├── FloatingWrappingProcessor.java │ │ │ ├── FloatingWrappingProcessor.kt │ │ │ ├── Generator.kt │ │ │ ├── GenericsProcessor.java │ │ │ ├── IntermediateOption.java │ │ │ ├── MalformedTemplateException.kt │ │ │ ├── NonexistentDimensionException.java │ │ │ ├── NonexistentDimensionException.kt │ │ │ ├── ObjectType.java │ │ │ ├── Option.java │ │ │ ├── OptionProcessor.java │ │ │ ├── OverviewProcessor.kt │ │ │ ├── PrimitiveType.java │ │ │ ├── PrimitiveTypeModifierPostProcessor.kt │ │ │ ├── PrimitiveTypeModifierPreProcessor.kt │ │ │ ├── PrintProcessor.kt │ │ │ ├── RawModifierProcessor.java │ │ │ ├── RawModifierProcessor.kt │ │ │ ├── RegexpUtils.java │ │ │ ├── SimpleOption.java │ │ │ ├── TemplateProcessor.java │ │ │ ├── concurrent │ │ │ ├── ForkJoinTaskShim.kt │ │ │ ├── ForkJoinTasks.kt │ │ │ ├── NoForkJoinTasks.kt │ │ │ └── RealForkJoinTasks.kt │ │ │ └── function │ │ │ ├── Predicate.java │ │ │ └── UnaryOperator.java │ │ └── test │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── jpsg │ │ └── GenerationTest.kt └── gradle-plugin │ ├── build.gradle │ └── src │ └── main │ ├── java │ └── com │ │ └── koloboke │ │ └── jpsg │ │ ├── GeneratorTask.java │ │ └── GradlePlugin.java │ └── resources │ └── META-INF │ └── gradle-plugins │ └── jpsg.properties ├── lib ├── api │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── koloboke │ │ │ │ └── collect │ │ │ │ ├── Container.java │ │ │ │ ├── ContainerFactory.java │ │ │ │ ├── Cursor.java │ │ │ │ ├── Equivalence.java │ │ │ │ ├── StatelessEquivalence.java │ │ │ │ ├── hash │ │ │ │ ├── HashContainer.java │ │ │ │ ├── HashContainerFactory.java │ │ │ │ ├── HashOverflowException.java │ │ │ │ ├── ObjHashFactory.java │ │ │ │ └── package-info.java │ │ │ │ ├── map │ │ │ │ ├── hash │ │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ │ └── set │ │ │ │ ├── hash │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ └── javaTemplates │ │ │ └── com │ │ │ └── koloboke │ │ │ ├── collect │ │ │ ├── CharCollection.java │ │ │ ├── CharCursor.java │ │ │ ├── CharIterator.java │ │ │ ├── ObjCollection.java │ │ │ ├── ObjIterator.java │ │ │ ├── hash │ │ │ │ ├── CharHashFactory.java │ │ │ │ └── HashConfig.java │ │ │ ├── map │ │ │ │ ├── CharShortCursor.java │ │ │ │ ├── CharShortMap.java │ │ │ │ ├── CharShortMapFactory.java │ │ │ │ └── hash │ │ │ │ │ ├── HashCharShortMap.java │ │ │ │ │ ├── HashCharShortMapFactory.java │ │ │ │ │ └── HashCharShortMaps.java │ │ │ ├── package-info.java │ │ │ └── set │ │ │ │ ├── CharSet.java │ │ │ │ ├── CharSetFactory.java │ │ │ │ └── hash │ │ │ │ ├── HashCharSet.java │ │ │ │ ├── HashCharSetFactory.java │ │ │ │ └── HashCharSets.java │ │ │ └── function │ │ │ ├── BiConsumer.java │ │ │ ├── BiFunction.java │ │ │ ├── BiPredicate.java │ │ │ ├── BinaryOperator.java │ │ │ ├── CharBinaryOperator.java │ │ │ ├── CharConsumer.java │ │ │ ├── CharFunction.java │ │ │ ├── CharObjFunction.java │ │ │ ├── CharPredicate.java │ │ │ ├── CharShortConsumer.java │ │ │ ├── CharShortPredicate.java │ │ │ ├── CharShortToShortFunction.java │ │ │ ├── CharToShortFunction.java │ │ │ ├── CharUnaryOperator.java │ │ │ ├── Consumer.java │ │ │ ├── Function.java │ │ │ ├── Predicate.java │ │ │ ├── ToCharFunction.java │ │ │ ├── UnaryOperator.java │ │ │ └── package-info.java │ │ └── test │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── collect │ │ └── hash │ │ └── HashConfigTest.java ├── build.gradle ├── impl-common │ ├── build.gradle │ ├── findbugs │ │ └── config │ │ │ └── excludeFilter.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── koloboke │ │ │ │ └── collect │ │ │ │ └── impl │ │ │ │ ├── AbstractEntry.java │ │ │ │ ├── AbstractSetView.java │ │ │ │ ├── AbstractView.java │ │ │ │ ├── CommonMapOps.java │ │ │ │ ├── CommonSetOps.java │ │ │ │ ├── Containers.java │ │ │ │ ├── InternalMapOps.java │ │ │ │ ├── Maths.java │ │ │ │ ├── PrimitiveConstants.java │ │ │ │ ├── Primitives.java │ │ │ │ ├── Scaler.java │ │ │ │ ├── UnsafeConstants.java │ │ │ │ ├── hash │ │ │ │ ├── Capacities.java │ │ │ │ ├── Hash.java │ │ │ │ ├── HashConfigWrapper.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ └── javaTemplates │ │ │ └── com │ │ │ └── koloboke │ │ │ └── collect │ │ │ └── impl │ │ │ ├── AbstractByteKeyView.java │ │ │ ├── AbstractShortValueView.java │ │ │ ├── ByteArrays.java │ │ │ ├── CommonByteCollectionOps.java │ │ │ ├── CommonByteShortMapOps.java │ │ │ ├── InternalByteCollectionOps.java │ │ │ ├── InternalByteShortMapOps.java │ │ │ ├── SupportedJdkVersion.java │ │ │ ├── ThreadLocalRandom.java │ │ │ └── hash │ │ │ ├── DHash.java │ │ │ ├── DHashCapacities.java │ │ │ ├── LHash.java │ │ │ ├── LHashCapacities.java │ │ │ ├── QHash.java │ │ │ └── QHashCapacities.java │ │ └── test │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── collect │ │ └── impl │ │ ├── ScalerTest.java │ │ └── hash │ │ └── HashConfigWrapperTest.java ├── impl-generator │ ├── build.gradle │ ├── findbugs │ │ └── config │ │ │ └── excludeFilter.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── jpsg │ │ └── collect │ │ ├── Method.java │ │ ├── MethodContext.java │ │ ├── MethodGeneratingProcessor.java │ │ ├── MethodGenerator.java │ │ ├── Permission.java │ │ ├── algo │ │ └── hash │ │ │ ├── HashBulkMethodGenerator.java │ │ │ ├── HashCursorMethodGenerator.java │ │ │ ├── HashIterMethodGeneratorCommons.java │ │ │ ├── HashIteratorMethodGenerator.java │ │ │ ├── HashMapQueryUpdateMethodGenerator.kt │ │ │ ├── HashMethodGeneratorCommons.kt │ │ │ ├── Index.java │ │ │ ├── Insert.java │ │ │ ├── KeySearch.java │ │ │ ├── LHashCloseDelayedRemoved.java │ │ │ ├── LHashRemoveAt.java │ │ │ ├── LHashShiftRemove.kt │ │ │ ├── Rehash.kt │ │ │ ├── TableType.java │ │ │ ├── TableTypeDimFilter.java │ │ │ ├── TableTypePostProcessor.java │ │ │ ├── TableTypePreProcessor.java │ │ │ └── ValueIndex.java │ │ ├── bulk │ │ ├── AllContainingIn.java │ │ ├── BulkMethod.java │ │ ├── BulkMethodGenerator.java │ │ ├── BulkRemoveUsingAnotherCollection.java │ │ ├── EntryType.java │ │ ├── ForEach.java │ │ ├── ForEachWhile.java │ │ ├── HashCode.java │ │ ├── ListHashCode.java │ │ ├── RemoveAll.java │ │ ├── RemoveIf.java │ │ ├── ReplaceAll.java │ │ ├── RetainAll.java │ │ ├── ReverseAddAllTo.java │ │ ├── ReversePutAllTo.java │ │ ├── ReverseRemoveAllFrom.java │ │ ├── SetHashCode.java │ │ ├── ToArray.java │ │ ├── ToPrimitiveArray.java │ │ ├── ToString.java │ │ └── ToTypedArray.java │ │ ├── iter │ │ ├── CursorMethodGenerator.java │ │ ├── IterMethod.java │ │ └── IteratorMethodGenerator.java │ │ └── mapqu │ │ ├── Add.java │ │ ├── AddValue.java │ │ ├── AddValueWithInitial.java │ │ ├── BasicMapQueryUpdateOp.java │ │ ├── Branch.java │ │ ├── Compute.java │ │ ├── ComputeIfAbsent.kt │ │ ├── ComputeIfPresent.java │ │ ├── ContainsEntry.java │ │ ├── ContainsKey.java │ │ ├── Get.java │ │ ├── GetOrDefault.java │ │ ├── JustPut.java │ │ ├── JustRemove.java │ │ ├── MapQueryUpdateMethod.java │ │ ├── MapQueryUpdateMethodGenerator.java │ │ ├── Merge.java │ │ ├── Put.java │ │ ├── PutIfAbsent.java │ │ ├── Remove.java │ │ ├── RemoveEntry.java │ │ ├── RemoveLike.java │ │ ├── Replace.java │ │ └── ReplaceEntry.java ├── impl │ ├── build.gradle │ ├── findbugs │ │ └── config │ │ │ └── excludeFilter.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── koloboke │ │ │ │ └── collect │ │ │ │ └── impl │ │ │ │ ├── AbstractContainer.java │ │ │ │ ├── NotGenerated.java │ │ │ │ ├── hash │ │ │ │ ├── AbstractHashFactory.java │ │ │ │ ├── HashWithoutRemovedSlots.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ ├── javaTemplates │ │ │ └── com │ │ │ │ └── koloboke │ │ │ │ └── collect │ │ │ │ └── impl │ │ │ │ └── hash │ │ │ │ ├── ByteDHashFactory.java │ │ │ │ ├── ByteHash.java │ │ │ │ ├── ByteHashFactorySO.java │ │ │ │ ├── DHashByteSetFactoryGO.java │ │ │ │ ├── DHashByteSetFactoryImpl.java │ │ │ │ ├── DHashByteSetFactorySO.java │ │ │ │ ├── DHashObjSetFactoryImpl.java │ │ │ │ ├── DHashObjSetFactorySO.java │ │ │ │ ├── DHashSeparateKVByteShortMapFactoryGO.java │ │ │ │ ├── DHashSeparateKVByteShortMapFactoryImpl.java │ │ │ │ ├── DHashSeparateKVByteShortMapFactorySO.java │ │ │ │ ├── DHashSeparateKVObjShortMapFactorySO.java │ │ │ │ ├── DoubleHash.java │ │ │ │ ├── DoubleHashFactorySO.java │ │ │ │ ├── ImmutableDHash.java │ │ │ │ ├── MutableByteDHashSetSO.java │ │ │ │ ├── MutableDHash.java │ │ │ │ ├── MutableDHashByteSet.java │ │ │ │ ├── MutableDHashByteSetGO.java │ │ │ │ ├── MutableDHashSeparateKVByteKeyMap.java │ │ │ │ ├── MutableDHashSeparateKVByteObjMapSO.java │ │ │ │ ├── MutableDHashSeparateKVByteShortMap.java │ │ │ │ ├── MutableDHashSeparateKVByteShortMapGO.java │ │ │ │ ├── MutableDHashSeparateKVByteShortMapSO.java │ │ │ │ ├── MutableLHash.java │ │ │ │ ├── MutableSeparateKVByteDHashGO.java │ │ │ │ ├── MutableSeparateKVByteDHashSO.java │ │ │ │ ├── MutableSeparateKVDoubleDHashSO.java │ │ │ │ ├── MutableSeparateKVObjDHashSO.java │ │ │ │ ├── ObjHash.java │ │ │ │ ├── ObjHashFactorySO.java │ │ │ │ ├── ParallelKVByteHash.java │ │ │ │ ├── SeparateKVByteDHash.java │ │ │ │ ├── SeparateKVByteHash.java │ │ │ │ └── SeparateKVByteShortDHash.java │ │ └── resourceTemplates │ │ │ └── META-INF │ │ │ └── services │ │ │ ├── com.koloboke.collect.map.hash.HashCharShortMapFactory │ │ │ └── com.koloboke.collect.set.hash.HashCharSetFactory │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── koloboke │ │ │ └── collect │ │ │ ├── hash │ │ │ ├── CharSequenceEquivalenceTest.java │ │ │ ├── HashConfigs.java │ │ │ ├── ObjHashConfig.java │ │ │ └── ObjHashConfigs.java │ │ │ └── impl │ │ │ └── hash │ │ │ └── Issue40.java │ │ └── javaTemplates │ │ └── com │ │ └── koloboke │ │ └── collect │ │ ├── hash │ │ ├── CharHashConfig.java │ │ └── CharHashConfigs.java │ │ ├── map │ │ └── hash │ │ │ ├── ByteKeyHashMapTest.java │ │ │ ├── ByteShortMapAddValueTest.java │ │ │ ├── HashCharShortMapTest.java │ │ │ ├── MahoutHashCharShortMapTest.java │ │ │ └── ObjCharMapTest.java │ │ └── set │ │ └── hash │ │ └── HashCharSetTest.java ├── template-processors │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── koloboke │ │ └── jpsg │ │ ├── FunctionProcessor.kt │ │ └── Jdk8FunctionReplacer.java └── testing │ ├── build.gradle │ └── src │ └── main │ ├── java │ └── com │ │ └── koloboke │ │ └── collect │ │ └── testing │ │ ├── CursorFeature.java │ │ ├── CursorKnownOrder.java │ │ ├── CursorTester.java │ │ ├── Iteration.java │ │ ├── Mutability.java │ │ ├── ObjSamples.java │ │ ├── Util.java │ │ └── map │ │ └── MapCursorTester.java │ └── javaTemplates │ └── com │ └── koloboke │ └── collect │ └── testing │ ├── AbstractCharCollectionTester.java │ ├── AbstractCursorTester.java │ ├── CharSamples.java │ ├── GuavaCharCollectionTestSuiteBuilder.java │ ├── Specials.java │ ├── map │ ├── AbstractCharShortMapTester.java │ ├── GuavaCharShortMapTestSuiteBuilder.java │ ├── HyperCharShortMapTestSuiteBuilder.java │ ├── TestCharShortMapGenerator.java │ └── testers │ │ ├── CharShortMapContainsKeyTester.java │ │ ├── CharShortMapContainsValueTester.java │ │ ├── CharShortMapCursorTester.java │ │ ├── CharShortMapGetTester.java │ │ ├── CharShortMapMergeTester.java │ │ ├── CharShortMapPutTester.java │ │ └── CharShortMapRemoveIfTester.java │ ├── set │ ├── GuavaCharSetTestSuiteBuilder.java │ ├── HyperCharSetTestSuiteBuilder.java │ └── TestCharSetGenerator.java │ └── testers │ ├── CharCollectionContainsAllTester.java │ ├── CharCollectionCursorTester.java │ ├── CharCollectionForEachTester.java │ ├── CharCollectionRemoveAllTester.java │ ├── CharCollectionRemoveIfTester.java │ └── CharCollectionRetainAllTester.java ├── methods.gradle └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | .gradle 3 | build/ 4 | 5 | # IntelliJ 6 | *.iml 7 | *.ipr 8 | *.iws 9 | out/ 10 | .idea/workspace.xml 11 | .idea/libraries 12 | .idea/uiDesigner.xml 13 | 14 | # HotSpot logs 15 | *.log 16 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Koloboke -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/copyright/apache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /benchmarks/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | maven { 5 | name 'Shadow' 6 | url 'http://dl.bintray.com/content/johnrengelman/gradle-plugins' 7 | } 8 | } 9 | 10 | dependencies { 11 | classpath project(':jpsg:gradle-plugin') 12 | classpath 'org.gradle.plugins:shadow:0.7.4' 13 | } 14 | } 15 | 16 | subprojects { 17 | dependencies { 18 | compile 'org.openjdk.jmh:jmh-core:0.9.8' 19 | compile (project(':lib:api'), project(':lib:impl')) 20 | } 21 | } 22 | 23 | configure([project('research'), project('time-vs-memory')]) { 24 | applyJpsg() 25 | apply plugin: 'shadow' 26 | 27 | dependencies { 28 | compile 'org.openjdk.jmh:jmh-generator-annprocess:0.9.8' 29 | compile 'net.openhft:lang:6.3.3' 30 | compile project("$parent.path:dimensioned-jmh") 31 | } 32 | 33 | jar.manifest.attributes 'Main-Class': 'org.openjdk.jmh.Main' 34 | 35 | shadow.outputFile = new File(libsDir, 'benchmarks.jar') 36 | 37 | build.doLast { 38 | tasks.shadow.execute() 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /benchmarks/dimensioned-jmh/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") -------------------------------------------------------------------------------- /benchmarks/research/README.md: -------------------------------------------------------------------------------- 1 | ## Research benchmarks ## 2 | 3 | # `com.koloboke.collect.research` # 4 | 5 | $ ./../../gradlew clean build 6 | $ java -cp build/libs/benchmarks.jar com.koloboke.collect.research.hash.LookupBenchmarks arity=binary hash=l states=bit queryResult=present key=int indexing=simple queries=uniform,zipf capacity=1048576 loadFactor=0.9 -v SILENT 7 | 8 | # `net.openhft.collections.research` # 9 | 10 | $ java -cp build/libs/benchmarks.jar net.openhft.collections.research.HashPosMapBenchmarks -v SILENT 11 | 12 | `-h`, `--help` supported. 13 | 14 | -------------------------------------------------------------------------------- /benchmarks/research/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | -------------------------------------------------------------------------------- /benchmarks/research/src/main/javaTemplates/com/koloboke/collect/research/hash/CharOps.java: -------------------------------------------------------------------------------- 1 | /* with char|byte|short|int|long key */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.research.hash; 19 | 20 | import java.util.concurrent.ThreadLocalRandom; 21 | 22 | 23 | public final class CharOps { 24 | 25 | static char randomExcept(char... specials) { 26 | search: 27 | while (true) { 28 | char c = (char) ThreadLocalRandom.current().nextLong(); 29 | for (char special : specials) { 30 | if (special == c) 31 | continue search; 32 | } 33 | return c; 34 | } 35 | } 36 | 37 | private CharOps() {} 38 | } 39 | -------------------------------------------------------------------------------- /benchmarks/time-vs-memory/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | 3 | dependencies { 4 | compile 'net.sf.trove4j:trove4j:3.0.3' 5 | compile 'com.carrotsearch:hppc:0.6.0' 6 | compile 'com.goldmansachs:gs-collections:5.1.0' 7 | compile 'it.unimi.dsi:fastutil:6.5.15' 8 | compile 'org.apache.mahout:mahout-math:0.9' 9 | 10 | compile 'org.openjdk.jol:jol-core:0.1' 11 | } -------------------------------------------------------------------------------- /compile/README.md: -------------------------------------------------------------------------------- 1 | # [Koloboke Compile](https://koloboke.com/compile) 2 | 3 | See [tutorial](tutorial.md) and [Javadocs]( 4 | http://leventov.github.io/Koloboke/compile/0.5/index.html). -------------------------------------------------------------------------------- /compile/eclipse-maven-preferences-apt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leventov/Koloboke/302e6d5e5889a80edb3aeed2e664f480439f8155/compile/eclipse-maven-preferences-apt.png -------------------------------------------------------------------------------- /compile/idea-annotation-processor-preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leventov/Koloboke/302e6d5e5889a80edb3aeed2e664f480439f8155/compile/idea-annotation-processor-preferences.png -------------------------------------------------------------------------------- /compile/src/main/java/com/koloboke/compile/mutability/Mutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.mutability; 18 | 19 | import java.lang.annotation.*; 20 | 21 | 22 | /** 23 | * Specifies that Koloboke Compile should generate a 25 | * mutable (general-purpose) implementation of the annotated class or interface. Element or 26 | * entry removal operations are allowed in mutable collections. 27 | * 28 | *

This annotation should be applied only for source code self-documentation purposes, because 29 | * not applying any of the annotations from the 30 | * 31 | * com.koloboke.compile.mutability package has the same effect. 32 | * 33 | * @see Updatable 34 | */ 35 | @Retention(RetentionPolicy.SOURCE) 36 | @Target(ElementType.TYPE) 37 | public @interface Mutable { 38 | } -------------------------------------------------------------------------------- /compile/src/main/java/com/koloboke/compile/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * The root package for the Koloboke Compile annotations. 19 | */ 20 | package com.koloboke.compile; -------------------------------------------------------------------------------- /compile/src/main/java/overview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This document is the specification for the annotations, recognized by the 4 | Koloboke Compile annotation processor. 5 | 6 |

{@link com.koloboke.compile.KolobokeMap @KolobokeMap} and {@link 7 | com.koloboke.compile.KolobokeSet @KolobokeSet} identify classes and interfaces which are subject for 8 | the Koloboke Compile processing and implementation generation. Most of other annotations specify 9 | features that the generated implementations should have. 10 | 11 |

If you want Koloboke Compile to generate an implementation of a {@link java.util.Map}-like 12 | interface or class, see the {@link com.koloboke.compile.KolobokeMap @KolobokeMap} specification. 13 | 14 |

If you want Koloboke Compile to generate an implementation of a {@link java.util.Set}-like 15 | interface or class, see the {@link com.koloboke.compile.KolobokeSet @KolobokeSet} specification. 16 | 17 |

See also the Koloboke Compile 19 | tutorial. 20 | 21 | -------------------------------------------------------------------------------- /compile/src/test/java/DefaultPackage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import com.koloboke.compile.KolobokeMap; 18 | 19 | 20 | @KolobokeMap 21 | public abstract class DefaultPackage { 22 | static class Key {} 23 | static class Value {} 24 | abstract Value put(Key key, Value value); 25 | } 26 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/ArrayParamsMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.hash.HashObjIntMap; 20 | 21 | import java.util.Map; 22 | 23 | 24 | @KolobokeMap 25 | @NullKeyAllowed(false) 26 | public abstract class ArrayParamsMap, V> 27 | implements HashObjIntMap { 28 | } 29 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/CustomDefaultValueMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | @KolobokeMap 20 | public abstract class CustomDefaultValueMap { 21 | 22 | public static CustomDefaultValueMap of() { 23 | return new KolobokeCustomDefaultValueMap(10); 24 | } 25 | 26 | public abstract int put(int key, int value); 27 | public abstract int get(int key); 28 | public abstract int addValue(int key, int addition); 29 | 30 | public final int defaultValue() { 31 | return -1; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/CustomDefaultValueMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.assertEquals; 22 | 23 | 24 | public class CustomDefaultValueMapTest { 25 | 26 | @Test 27 | public void testCustomDefaultValueMap() { 28 | CustomDefaultValueMap map = CustomDefaultValueMap.of(); 29 | assertEquals(-1, map.get(42)); 30 | assertEquals(1, map.addValue(42, 2)); 31 | assertEquals(3, map.addValue(42, 2)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/FloatDoubleMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.compile.hash.algo.openaddressing.LinearProbing; 20 | 21 | 22 | @KolobokeMap 23 | @LinearProbing 24 | public abstract class FloatDoubleMap { 25 | 26 | abstract void justPut(float key, double value); 27 | abstract boolean justRemove(float key); 28 | } 29 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/GenericGetParamMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | @KolobokeMap 20 | public abstract class GenericGetParamMap { 21 | 22 | public abstract V get(K key); 23 | 24 | abstract V put(K key, V value); 25 | } 26 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/IndirectGenericSpecializationMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | 20 | import com.koloboke.compile.mutability.Updatable; 21 | 22 | import java.util.*; 23 | 24 | 25 | @KolobokeMap 26 | @Updatable 27 | public abstract class IndirectGenericSpecializationMap implements SuperGeneric { 28 | 29 | abstract boolean justRemove(List key); 30 | 31 | @Override 32 | public abstract String toString(); 33 | 34 | @Override 35 | public abstract boolean equals(Object obj); 36 | 37 | @Override 38 | public abstract int hashCode(); 39 | } 40 | 41 | interface SuperGeneric extends Map, Set> { 42 | } -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/InnerClassParamSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.compile.mutability.Mutable; 20 | 21 | import java.util.Map; 22 | import java.util.Set; 23 | 24 | @KolobokeSet 25 | @Mutable 26 | public abstract class InnerClassParamSet> 27 | implements Set>.Bar> { 28 | 29 | static class Foo { 30 | 31 | class Bar {} 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/InverseParamsMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.hash.HashObjObjMap; 20 | 21 | 22 | @KolobokeMap 23 | public abstract class InverseParamsMap implements HashObjObjMap { 24 | } 25 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/MyIntLongMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.IntLongMap; 20 | 21 | 22 | @KolobokeMap 23 | public abstract class MyIntLongMap implements IntLongMap { 24 | } 25 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/MyLongLongMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import java.util.Map; 20 | 21 | 22 | @KolobokeMap 23 | public abstract class MyLongLongMap implements Map { 24 | 25 | abstract long get(long key); 26 | 27 | abstract long put(long key, long value); 28 | } 29 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/NestedClassKolobokeAnnotatedMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.compile.mutability.Updatable; 20 | 21 | import java.util.Map; 22 | 23 | @KolobokeMap 24 | @Updatable 25 | public abstract class NestedClassKolobokeAnnotatedMap implements Map { 26 | 27 | @KolobokeSet 28 | interface NestedSet { 29 | boolean add(K key); 30 | 31 | @KolobokeMap 32 | abstract class InterfaceNested { 33 | abstract V put(K key, V value); 34 | } 35 | } 36 | 37 | @KolobokeMap 38 | static abstract class InnerClass { 39 | abstract V put(int key, V value); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/OneParamExtendsAnotherMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.hash.HashObjIntMap; 20 | 21 | import java.util.Map; 22 | 23 | 24 | @KolobokeMap 25 | public abstract class OneParamExtendsAnotherMap, E extends T> 26 | implements HashObjIntMap { 27 | } 28 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/ParamsAreArgsOfActualKeysValuesMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.compile.mutability.Mutable; 20 | import com.koloboke.compile.mutability.Updatable; 21 | 22 | import java.util.List; 23 | import java.util.Map; 24 | 25 | 26 | @KolobokeMap 27 | @Mutable 28 | public abstract class ParamsAreArgsOfActualKeysValuesMap implements Map, List> { 29 | } 30 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/ReturnTypeCovarianceMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import java.util.*; 20 | 21 | 22 | @KolobokeMap 23 | interface ReturnTypeCovarianceMap { 24 | Object put(K key, List value); 25 | Collection replace(K key, List value); 26 | Set keySet(); 27 | } 28 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/SameKeyAndValueTypeMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.hash.HashObjObjMap; 20 | 21 | 22 | @KolobokeMap 23 | @ConcurrentModificationUnchecked 24 | public abstract class SameKeyAndValueTypeMap implements HashObjObjMap { 25 | } 26 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/StaticNestedKeysAndValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.compile.StaticNestedKeysAndValuesOtherClass.Value; 20 | 21 | @KolobokeMap 22 | public abstract class StaticNestedKeysAndValues { 23 | static class Key {} 24 | 25 | abstract Value put(Key key, Value value); 26 | } 27 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/StaticNestedKeysAndValuesOtherClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | public class StaticNestedKeysAndValuesOtherClass { 20 | static class Value {} 21 | } 22 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/StringIntMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.hash.HashObjIntMap; 20 | 21 | 22 | @KolobokeMap 23 | public abstract class StringIntMap implements HashObjIntMap { 24 | 25 | public static StringIntMap withExpectedSize(int expectedSize) { 26 | return new KolobokeStringIntMap(expectedSize); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/StringStringMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | 20 | import com.koloboke.compile.hash.algo.openaddressing.DoubleHashing; 21 | 22 | 23 | @KolobokeMap 24 | @DoubleHashing 25 | @NullKeyAllowed 26 | public abstract class StringStringMap { 27 | abstract String get(String key); 28 | abstract String put(String key, String value); 29 | abstract int size(); 30 | 31 | final int keyHashCode(String key) { 32 | return key.hashCode(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/StringVMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import java.util.Map; 20 | 21 | 22 | @KolobokeMap 23 | public abstract class StringVMap implements Map { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/TParamSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import java.util.Set; 20 | 21 | 22 | /** 23 | * Tests toArray() param rename (because declared with a param also named T, by default). 24 | * Should be renamed to T2. 25 | */ 26 | @KolobokeSet 27 | public abstract class TParamSet implements Set { 28 | 29 | public static TParamSet withExpectedSize(int expectedSize) { 30 | return new KolobokeTParamSet(expectedSize); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/TParamSetTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | 23 | public class TParamSetTest { 24 | 25 | @Test 26 | public void testTParamSet() { 27 | TParamSet set = TParamSet.withExpectedSize(1); 28 | set.add("foo"); 29 | CharSequence[] elems = set.toArray(new CharSequence[0]); 30 | Assert.assertEquals("foo", elems[0]); 31 | elems = set.toArray(elems); 32 | Assert.assertEquals("foo", elems[0]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/ValueParamExtendsKeyParamMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import com.koloboke.collect.map.hash.HashObjObjMap; 20 | import com.koloboke.compile.hash.algo.openaddressing.DoubleHashing; 21 | 22 | 23 | @KolobokeMap 24 | @DoubleHashing 25 | @NullKeyAllowed(false) 26 | public abstract class ValueParamExtendsKeyParamMap implements HashObjObjMap { 27 | 28 | abstract boolean justRemove(Object key); 29 | } 30 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/Cache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | 21 | 22 | @KolobokeMap 23 | abstract class Cache { 24 | static Cache withExpectedSize(int expectedSize) { 25 | return new KolobokeCache(expectedSize); 26 | } 27 | 28 | abstract V put(K key, V value); 29 | 30 | abstract V get(K key); 31 | 32 | abstract void clear(); 33 | 34 | abstract int size(); 35 | } 36 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/CharArrayMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.CustomKeyEquivalence; 20 | import com.koloboke.compile.KolobokeMap; 21 | 22 | import java.util.Arrays; 23 | import java.util.Map; 24 | 25 | 26 | @KolobokeMap 27 | @CustomKeyEquivalence 28 | public abstract class CharArrayMap implements Map { 29 | 30 | static Map withExpectedSize(int expectedSize) { 31 | return new KolobokeCharArrayMap(expectedSize); 32 | } 33 | 34 | final boolean keyEquals(char[] queriedKey, char[] keyInMap) { 35 | return Arrays.equals(queriedKey, keyInMap); 36 | } 37 | 38 | final int keyHashCode(char[] key) { 39 | return Arrays.hashCode(key); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/ExtendedMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.collect.map.hash.HashObjObjMap; 20 | import com.koloboke.compile.KolobokeMap; 21 | import com.koloboke.function.BiConsumer; 22 | import com.koloboke.function.BiPredicate; 23 | 24 | 25 | @KolobokeMap 26 | abstract class ExtendedMap implements HashObjObjMap { 27 | static ExtendedMap withExpectedSize(int expectedSize) { 28 | return new KolobokeExtendedMap(expectedSize); 29 | } 30 | public abstract V get(String key); 31 | @Override 32 | public abstract V put(String key, V value); 33 | @Override 34 | public abstract int size(); 35 | @Override 36 | public abstract void forEach(BiConsumer action); 37 | @Override 38 | public abstract boolean removeIf(BiPredicate predicate); 39 | @Override 40 | public abstract boolean shrink(); 41 | } 42 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/IdentityToIntMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.CustomKeyEquivalence; 20 | import com.koloboke.compile.KolobokeMap; 21 | 22 | import java.util.Map; 23 | 24 | 25 | @KolobokeMap 26 | @CustomKeyEquivalence 27 | abstract class IdentityToIntMap implements Map { 28 | 29 | static IdentityToIntMap withExpectedSize(int expectedSize) { 30 | return new KolobokeIdentityToIntMap(expectedSize); 31 | } 32 | 33 | abstract int getInt(K key); 34 | abstract int put(K key, int value); 35 | 36 | /** 37 | * Returns just {@code false} because keyEquals() contract guarantees that arguments are 38 | * not identical, see {@link CustomKeyEquivalence} javadocs. 39 | */ 40 | final boolean keyEquals(K queriedKey, K keyInMap) { 41 | return false; 42 | } 43 | 44 | final int keyHashCode(K key) { 45 | return System.identityHashCode(key); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/IdentityToIntMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.assertEquals; 22 | import static org.junit.Assert.assertNull; 23 | 24 | 25 | public class IdentityToIntMapTest { 26 | 27 | @Test 28 | public void testIdentityMap() { 29 | IdentityToIntMap map = IdentityToIntMap.withExpectedSize(10); 30 | String oneFoo = "foo"; 31 | String anotherFoo = new String("foo"); 32 | map.put(oneFoo, 1); 33 | assertEquals(1, map.getInt(oneFoo)); 34 | assertEquals(0, map.getInt(anotherFoo)); 35 | assertNull(map.get(anotherFoo)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/MinusOneDefaultValueObjIntMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.collect.map.ObjIntMap; 20 | import com.koloboke.compile.KolobokeMap; 21 | 22 | 23 | @KolobokeMap 24 | abstract class MinusOneDefaultValueObjIntMap implements ObjIntMap { 25 | 26 | static ObjIntMap withExpectedSize(int expectedSize) { 27 | return new KolobokeMinusOneDefaultValueObjIntMap(expectedSize); 28 | } 29 | 30 | @Override 31 | public final int defaultValue() { 32 | return -1; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/MyIntLongMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | 21 | import java.util.Map; 22 | 23 | 24 | @KolobokeMap 25 | abstract class MyIntLongMap implements Map { 26 | static Map withExpectedSize(int expectedSize) { 27 | return new KolobokeMyIntLongMap(expectedSize); 28 | } 29 | 30 | abstract long put(int key, long value); 31 | 32 | abstract long get(int key); 33 | } 34 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/MyMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.collect.hash.HashConfig; 20 | import com.koloboke.compile.KolobokeMap; 21 | import java.util.Map; 22 | 23 | @KolobokeMap 24 | abstract class MyMap implements Map { 25 | static Map withExpectedSize(int expectedSize) { 26 | return new KolobokeMyMap(expectedSize); 27 | } 28 | 29 | static Map sparseWithExpectedSize(int expectedSize) { 30 | return new KolobokeMyMap(HashConfig.fromLoads(0.25, 0.375, 0.5), expectedSize); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/MySet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeSet; 20 | import java.util.Set; 21 | 22 | @KolobokeSet 23 | abstract class MySet implements Set { 24 | static Set withExpectedSize(int expectedSize) { 25 | return new KolobokeMySet(expectedSize); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/NonnullKeyMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | import com.koloboke.compile.NullKeyAllowed; 21 | 22 | import java.util.Map; 23 | 24 | 25 | @KolobokeMap 26 | @NullKeyAllowed(false) 27 | abstract class NonnullKeyMap implements Map { 28 | static Map withExpectedSize(int expectedSize) { 29 | return new KolobokeNonnullKeyMap(expectedSize); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/NonnullKeyMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | import java.util.Map; 23 | 24 | 25 | public class NonnullKeyMapTest { 26 | 27 | @Test 28 | public void testNonnullKeyMap() { 29 | Map map = NonnullKeyMap.withExpectedSize(10); 30 | try { 31 | map.put(null, "foo"); 32 | Assert.fail("expected NullPointerException"); 33 | } catch (NullPointerException ignore) { 34 | // expected 35 | } 36 | 37 | try { 38 | map.get(null); 39 | Assert.fail("expected NullPointerException"); 40 | } catch (NullPointerException ignore) { 41 | // expected 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/OptimizedMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | 21 | 22 | @KolobokeMap 23 | public abstract class OptimizedMap { 24 | 25 | static OptimizedMap withExpectedSize(int expectedSize) { 26 | return new KolobokeOptimizedMap(expectedSize); 27 | } 28 | 29 | abstract void justPut(K key, int value); 30 | 31 | abstract int getInt(K key); 32 | 33 | abstract boolean justRemove(K key); 34 | } 35 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/QuadraticHashingMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.collect.hash.HashConfig; 20 | import com.koloboke.compile.KolobokeMap; 21 | import com.koloboke.compile.hash.algo.openaddressing.QuadraticHashing; 22 | 23 | @KolobokeMap 24 | @QuadraticHashing 25 | abstract class QuadraticHashingMap { 26 | 27 | static QuadraticHashingMap withExpectedSize(int expectedSize) { 28 | return new KolobokeQuadraticHashingMap( 29 | HashConfig.getDefault().withGrowthFactor(1.5), expectedSize); 30 | } 31 | 32 | abstract String get(int key); 33 | 34 | abstract String put(int key, String value); 35 | } 36 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/SmallerLongIntMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | 21 | import java.util.AbstractMap; 22 | 23 | 24 | @KolobokeMap 25 | abstract class SmallerLongIntMap extends AbstractMap { 26 | static SmallerLongIntMap withExpectedSize(int expectedSize) { 27 | return new KolobokeSmallerLongIntMap(expectedSize); 28 | } 29 | 30 | abstract int get(long key); 31 | abstract int put(long key, int value); 32 | } 33 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/StringIntMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | 21 | 22 | @KolobokeMap 23 | abstract class StringIntMap { 24 | static StringIntMap withExpectedSize(int expectedSize) { 25 | return new KolobokeStringIntMap(expectedSize); 26 | } 27 | abstract int put(String key, int value); 28 | 29 | abstract int getInt(String key); 30 | 31 | abstract int removeAsInt(String key); 32 | } 33 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/SynchronizedMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | import com.koloboke.compile.MethodForm; 21 | 22 | 23 | @KolobokeMap 24 | public abstract class SynchronizedMap { 25 | public static SynchronizedMap withExpectedSize(int expectedSize) { 26 | return new KolobokeSynchronizedMap(expectedSize); 27 | } 28 | 29 | public final synchronized V get(K key) { 30 | return subGet(key); 31 | } 32 | 33 | public final synchronized V put(K key, V value) { 34 | return subPut(key, value); 35 | } 36 | 37 | public final synchronized int size() { 38 | return subSize(); 39 | } 40 | 41 | @MethodForm("get") 42 | abstract V subGet(K key); 43 | 44 | @MethodForm("put") 45 | abstract V subPut(K key, V value); 46 | 47 | @MethodForm("size") 48 | abstract int subSize(); 49 | } 50 | -------------------------------------------------------------------------------- /compile/src/test/java/com/koloboke/compile/fromdocs/Tickers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile.fromdocs; 18 | 19 | import com.koloboke.compile.KolobokeMap; 20 | 21 | import java.util.Map; 22 | 23 | @KolobokeMap 24 | abstract class Tickers implements Map { 25 | static Tickers withExpectedSize(int expectedSize) { 26 | return new KolobokeTickers(expectedSize); 27 | } 28 | 29 | static Tickers of() { 30 | return withExpectedSize(10); 31 | } 32 | 33 | static Tickers fromMap(Map m) { 34 | Tickers tickers = withExpectedSize(m.size()); 35 | tickers.putAll(m); 36 | return tickers; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /compile/src/testJava8/java/com/koloboke/compile/MyGenericMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.compile; 18 | 19 | import java.util.Map; 20 | 21 | 22 | @KolobokeMap 23 | public interface MyGenericMap, S> extends Map { 24 | 25 | default int keyHashCode(T key) { 26 | return System.identityHashCode(key); 27 | } 28 | 29 | default boolean keyEquals(T a, T b) { 30 | return a == b; 31 | } 32 | 33 | Object[] table(); 34 | } 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.configureondemand=true 2 | libTargetJava=6 3 | org.gradle.jvmargs=-ea:com.koloboke.jpsg... -server -XX:+AggressiveOpts -XX:+UseParallelOldGC -XX:+UseCompressedOops -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leventov/Koloboke/302e6d5e5889a80edb3aeed2e664f480439f8155/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 01 02:10:50 MSK 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip 7 | -------------------------------------------------------------------------------- /jpsg/README.md: -------------------------------------------------------------------------------- 1 | JPSG stands for Java Primitive Specializations Generator -------------------------------------------------------------------------------- /jpsg/build.gradle: -------------------------------------------------------------------------------- 1 | configure([project('core'), project('gradle-plugin')]) { 2 | configurePublishing(project) 3 | archivesBaseName = "jpsg-$project.name" 4 | version = meta_projects_version 5 | poms*.whenConfigured { pom -> 6 | pom.project { 7 | name = "JPSG ${project.name.capitalize()}" 8 | description = "Java Primitive Specializations Generator $project.description" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /jpsg/cli/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(":jpsg:core") 3 | compile 'com.beust:jcommander:1.32' 4 | } -------------------------------------------------------------------------------- /jpsg/core/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | buildscript { 3 | repositories { 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 9 | } 10 | } 11 | 12 | description = 'core' 13 | 14 | apply plugin: 'kotlin' 15 | 16 | setSourceCompatibility(1.6) 17 | 18 | dependencies { 19 | compile "org.slf4j:slf4j-api:$slf4j_version" 20 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 21 | } -------------------------------------------------------------------------------- /jpsg/core/findbugs/config/excludeFilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/BitsModifierPostProcessor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg 18 | 19 | import com.koloboke.jpsg.function.Predicate 20 | import com.koloboke.jpsg.function.UnaryOperator 21 | 22 | class BitsModifierPostProcessor : PrimitiveTypeModifierPostProcessor( 23 | "bits", UnaryOperator { it.bitsType() }, Predicate { dim -> true }) 24 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/BitsModifierPreProcessor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg 18 | 19 | import com.koloboke.jpsg.function.Predicate 20 | import com.koloboke.jpsg.function.UnaryOperator 21 | 22 | class BitsModifierPreProcessor : PrimitiveTypeModifierPreProcessor( 23 | "bits", UnaryOperator { it.bitsType() }, Predicate { dim -> true }) 24 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/NonexistentDimensionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg; 18 | 19 | final class NonexistentDimensionException extends Exception { 20 | } 21 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/NonexistentDimensionException.kt: -------------------------------------------------------------------------------- 1 | ///* 2 | // * Copyright 2014 the original author or authors. 3 | // * 4 | // * Licensed under the Apache License, Version 2.0 (the "License"); 5 | // * you may not use this file except in compliance with the License. 6 | // * You may obtain a copy of the License at 7 | // * 8 | // * http://www.apache.org/licenses/LICENSE-2.0 9 | // * 10 | // * Unless required by applicable law or agreed to in writing, software 11 | // * distributed under the License is distributed on an "AS IS" BASIS, 12 | // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // * See the License for the specific language governing permissions and 14 | // * limitations under the License. 15 | // */ 16 | // 17 | //package com.koloboke.jpsg 18 | // 19 | //internal class NonexistentDimensionException : Exception() 20 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/Option.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg; 18 | 19 | 20 | public interface Option { 21 | 22 | abstract String intermediateReplace(String content, String dim); 23 | 24 | abstract String finalReplace(String content, String dim); 25 | } -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/RegexpUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg; 18 | 19 | import java.util.regex.Pattern; 20 | 21 | import static java.util.regex.Pattern.*; 22 | 23 | 24 | public final class RegexpUtils { 25 | 26 | public static final String JAVA_ID_OR_CONST = "[a-zA-Z\\d_$]++(\\.[a-zA-Z\\d_$]++)?"; 27 | 28 | public static final int STANDARD_TEMPLATE_FLAGS = CASE_INSENSITIVE | DOTALL | MULTILINE; 29 | 30 | public static Pattern compile(String regex) { 31 | return Pattern.compile(regex, STANDARD_TEMPLATE_FLAGS); 32 | } 33 | 34 | public static String removeSubGroupNames(String regex) { 35 | return regex.replaceAll("\\?<[a-z]+?>", ""); 36 | } 37 | 38 | 39 | private RegexpUtils() {} 40 | } 41 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/concurrent/ForkJoinTaskShim.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.concurrent 18 | 19 | 20 | interface ForkJoinTaskShim { 21 | fun get(): T 22 | /** 23 | * Real FJT: fork().join() 24 | * No FJT: just call the task in this thread 25 | */ 26 | fun forkAndGet(): T 27 | } -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/concurrent/NoForkJoinTasks.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.concurrent 18 | 19 | import java.util.concurrent.Callable 20 | 21 | internal class NoForkJoinTasks : ForkJoinTasks { 22 | override fun adapt(callable: Callable): ForkJoinTaskShim { 23 | return NoForkJoinTask(callable) 24 | } 25 | 26 | override fun invokeAll(tasks: Iterable>) { 27 | tasks.forEach { it.get() } 28 | } 29 | } 30 | 31 | private class NoForkJoinTask(val callable: Callable) : ForkJoinTaskShim { 32 | override fun get() = callable.call() 33 | override fun forkAndGet() = callable.call() 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/function/Predicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.function; 18 | 19 | public interface Predicate { 20 | 21 | boolean test(T t); 22 | } 23 | -------------------------------------------------------------------------------- /jpsg/core/src/main/java/com/koloboke/jpsg/function/UnaryOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.function; 18 | 19 | public interface UnaryOperator { 20 | 21 | T apply(T t); 22 | } 23 | -------------------------------------------------------------------------------- /jpsg/core/src/test/java/com/koloboke/jpsg/GenerationTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg 18 | 19 | import org.junit.Assert.assertEquals 20 | import org.junit.Test 21 | import java.io.File 22 | 23 | class GenerationTest { 24 | 25 | @Test 26 | fun generationTest() { 27 | val generator = Generator() 28 | generator.init() 29 | Generator.setCurrentSourceFile(File("package-info.java")) 30 | val cxt = Context.builder().put("jdk", SimpleOption("JDK6")).makeContext() 31 | val result = generator.generate(source = cxt, target = cxt, template = "package-info.java") 32 | assertEquals("package-info.java", result) 33 | } 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /jpsg/gradle-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | 3 | description = 'Gradle plugin' 4 | 5 | dependencies { 6 | compile project("$parent.path:core") 7 | compile gradleApi() 8 | } -------------------------------------------------------------------------------- /jpsg/gradle-plugin/src/main/resources/META-INF/gradle-plugins/jpsg.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.koloboke.jpsg.GradlePlugin -------------------------------------------------------------------------------- /lib/api/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | 3 | description = 'API' 4 | 5 | repositories { 6 | mavenCentral() 7 | mavenLocal() 8 | } 9 | 10 | dependencies { 11 | // just for Javadoc links 12 | provided 'com.koloboke:koloboke-compile:0.5' 13 | } 14 | poms*.whenConfigured { pom -> 15 | pom.dependencies.removeAll { dep -> dep.artifactId == 'koloboke-compile' } 16 | } 17 | 18 | configure(javadoc) { 19 | title "Koloboke Collections $apiVersion API" 20 | configure((StandardJavadocDocletOptions) getOptions()) { 21 | def javaDocJava = project.hasProperty('javadocJava') ? javadocJava : libTargetJava 22 | links("https://javadoc.io/doc/com.google.code.findbugs/annotations/$findbugs_version/", 23 | "http://leventov.github.io/Koloboke/compile/0.5/", 24 | "http://docs.oracle.com/javase/$javaDocJava/docs/api/") 25 | overview "$buildDir/generated-src/jpsg/main/java/overview.html" 26 | addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : 27 | "$System.env.JAVA_HOME/src") 28 | if (libTargetJava == '8') 29 | // to suppress warnings in JDK sources 30 | addStringOption('tag', 'implSpec') 31 | addStringOption('noqualifier', 'java.lang:java.util') 32 | use = true // generate Use pages 33 | } 34 | executable = project.hasProperty('javadocExecutable') ? javadocExecutable : null 35 | } -------------------------------------------------------------------------------- /lib/api/src/main/java/com/koloboke/collect/hash/HashOverflowException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.hash; 19 | 20 | /** 21 | * An exception thrown when element or entry couldn't be inserted into the hash container 22 | * due to implementation limitations. 23 | */ 24 | public class HashOverflowException extends IllegalStateException { 25 | private static final long serialVersionUID = 0L; 26 | 27 | /** 28 | * A sole constructor. 29 | */ 30 | public HashOverflowException() { 31 | super(); 32 | } 33 | } -------------------------------------------------------------------------------- /lib/api/src/main/java/com/koloboke/collect/hash/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Contains basic interfaces and commonly used classes related to containers, based on hash tables. 19 | * 20 | *

Note that unless otherwise specified, in the library "hash table" means only hash tables with 21 | * open addressing method of collision 22 | * resolution. 23 | * 24 | * @see com.koloboke.collect.hash.HashContainer 25 | * @see 26 | * com.koloboke.collect.set.hash 27 | * @see 28 | * com.koloboke.collect.map.hash 29 | */ 30 | package com.koloboke.collect.hash; -------------------------------------------------------------------------------- /lib/api/src/main/java/com/koloboke/collect/map/hash/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Contains interfaces of {@link java.util.Map} specializations, based on hash tables, 19 | * their factories and static factory methods. 20 | * 21 | * @see com.koloboke.collect.hash 22 | */ 23 | package com.koloboke.collect.map.hash; -------------------------------------------------------------------------------- /lib/api/src/main/java/com/koloboke/collect/map/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Contains interfaces of {@link java.util.Map} specializations, their factories and cursors. 19 | */ 20 | package com.koloboke.collect.map; -------------------------------------------------------------------------------- /lib/api/src/main/java/com/koloboke/collect/set/hash/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Contains interfaces of {@link java.util.Set} specializations, based on hash tables, 19 | * their factories and static factory methods. 20 | * 21 | * @see com.koloboke.collect.hash 22 | */ 23 | package com.koloboke.collect.set.hash; -------------------------------------------------------------------------------- /lib/api/src/main/java/com/koloboke/collect/set/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Contains interfaces of {@link java.util.Set} specializations and their factories. 19 | */ 20 | package com.koloboke.collect.set; -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/collect/set/hash/HashCharSet.java: -------------------------------------------------------------------------------- 1 | /* with char|byte|short|int|long|float|double|obj elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.set.hash; 19 | 20 | import com.koloboke.collect.hash.HashContainer; 21 | import com.koloboke.collect.set.CharSet; 22 | import com.koloboke.compile.KolobokeSet; 23 | 24 | 25 | /** 26 | * An interface for {@code CharSet}s, based on hash tables. 27 | * 28 | *

This interface doesn't carry own specific behaviour, just combines it's superinterfaces. 29 | * 30 | *

Looking for a way to instantiate a {@code HashCharSet}? See static factory methods 31 | * in {@link HashCharSets} class. 32 | * 33 | * @see HashCharSets 34 | * @see HashCharSetFactory 35 | * @see KolobokeSet @KolobokeSet 36 | */ 37 | public interface HashCharSet/*<>*/ extends CharSet/*<>*/, HashContainer { 38 | } 39 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/BinaryOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.function; 18 | 19 | 20 | /** 21 | * // if !(JDK8 jdk) // 22 | * Represents an operation upon two operands of the same type, producing a result 23 | * of the same type as the operands. This is a specialization of 24 | * {@link BiFunction} for the case where the operands and the result are all of 25 | * the same type. 26 | * 27 | * @param the type of the operands and result of the operator 28 | * @see BiFunction 29 | * @see UnaryOperator 30 | * // elif JDK8 jdk // 31 | * @deprecated this interface is present for backward compatibility with the version of this library 32 | * for Java 6 or 7, use {@link java.util.function.BinaryOperator} instead. 33 | * // endif // 34 | */ 35 | /* if JDK8 jdk */@FunctionalInterface @Deprecated/* endif */ 36 | public interface BinaryOperator extends BiFunction 37 | /* if JDK8 jdk */, java.util.function.BinaryOperator/* endif */ { 38 | } 39 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/CharObjFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.function; 18 | 19 | /** 20 | * Represents a function that accepts //a// {@code char}-valued and an object-valued argument 21 | * and returns a result. This is the {@code (char, reference, reference)} specialization 22 | * of {@link BiFunction}. 23 | * 24 | * @param the type of the first argument to the function 25 | * @param the type of the result of the function 26 | * @see BiFunction 27 | */ 28 | /* if JDK8 jdk */@FunctionalInterface/* endif */ 29 | public interface CharObjFunction { 30 | 31 | /** 32 | * Applies this function to the given arguments. 33 | * 34 | * @param v the first function argument 35 | * @param t the second function argument 36 | * @return the function result 37 | */ 38 | R apply(char v, T t); 39 | } 40 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/Consumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.function; 18 | 19 | 20 | /** 21 | * // if !(JDK8 jdk) // 22 | * Represents an operation that accepts a single input argument and returns no 23 | * result. Unlike most other functional interfaces, {@code Consumer} is expected 24 | * to operate via side-effects. 25 | * 26 | * @param the type of the input to the operation 27 | * // elif JDK8 jdk // 28 | * @deprecated this interface is present for backward compatibility with the version of this library 29 | * for Java 6 or 7, use {@link java.util.function.Consumer} instead. 30 | * // endif // 31 | */ 32 | /* if JDK8 jdk */@FunctionalInterface @Deprecated/* endif */ 33 | public interface Consumer/* if JDK8 jdk */ extends java.util.function.Consumer/* endif */ { 34 | 35 | /* if !(JDK8 jdk) */ 36 | /** 37 | * Performs this operation on the given argument. 38 | * 39 | * @param t the input argument 40 | */ 41 | void accept(T t); 42 | /* endif */ 43 | } 44 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/Function.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.function; 18 | 19 | 20 | /** 21 | * // if !(JDK8 jdk) // 22 | * Represents a function that accepts one argument and produces a result. 23 | * 24 | * @param the type of the input to the function 25 | * @param the type of the result of the function 26 | * // elif JDK8 jdk // 27 | * @deprecated this interface is present for backward compatibility with the version of this library 28 | * for Java 6 or 7, use {@link java.util.function.Function} instead. 29 | * // endif // 30 | */ 31 | /* if JDK8 jdk */@FunctionalInterface @Deprecated/* endif */ 32 | public interface Function 33 | /* if JDK8 jdk */extends java.util.function.Function /* endif */{ 34 | 35 | /* if !(JDK8 jdk) */ 36 | /** 37 | * Applies this function to the given argument. 38 | * 39 | * @param t the function argument 40 | * @return the function result 41 | */ 42 | R apply(T t); 43 | /* endif */ 44 | } 45 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/Predicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.function; 18 | 19 | 20 | /** 21 | * // if !(JDK8 jdk) // 22 | * Represents a predicate (boolean-valued function) of one argument. 23 | * 24 | * @param the type of the input to the predicate 25 | * // elif JDK8 jdk // 26 | * @deprecated this interface is present for backward compatibility with the version of this library 27 | * for Java 6 or 7, use {@link java.util.function.Predicate} instead. 28 | * // endif // 29 | */ 30 | /* if JDK8 jdk */@FunctionalInterface @Deprecated/* endif */ 31 | public interface Predicate/* if JDK8 jdk */ extends java.util.function.Predicate/* endif */ { 32 | 33 | /* if !(JDK8 jdk) */ 34 | /** 35 | * Evaluates this predicate on the given argument. 36 | * 37 | * @param t the input argument 38 | * @return {@code true} if the input argument matches the predicate, 39 | * otherwise {@code false} 40 | */ 41 | boolean test(T t); 42 | /* endif */ 43 | } 44 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/UnaryOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.function; 18 | 19 | 20 | /** 21 | * // if !(JDK8 jdk) // 22 | * Represents an operation on a single operand that produces a result of the 23 | * same type as its operand. This is a specialization of {@code Function} for 24 | * the case where the operand and result are of the same type. 25 | * 26 | * @param the type of the operand and result of the operator 27 | * @see Function 28 | * // elif JDK8 jdk // 29 | * @deprecated this interface is present for backward compatibility with the version of this library 30 | * for Java 6 or 7, use {@link java.util.function.UnaryOperator} instead. 31 | * // endif // 32 | */ 33 | /* if JDK8 jdk */@FunctionalInterface @Deprecated/* endif */ 34 | public interface UnaryOperator extends Function 35 | /* if JDK8 jdk */, java.util.function.UnaryOperator/* endif */ { 36 | } 37 | -------------------------------------------------------------------------------- /lib/api/src/main/javaTemplates/com/koloboke/function/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * // if JDK8 jdk //{@link java.util.function} polyfill for all specializations. 19 | * // elif !(JDK8 jdk) //The complete set of functional interfaces, following 20 | * 21 | * {@code java.util.function} scheme. 22 | * // endif // 23 | * 24 | * @see 25 | * Java 8 Functional Interface Naming Guide 26 | */ 27 | package com.koloboke.function; -------------------------------------------------------------------------------- /lib/impl-common/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | 3 | description = 'Implementation Commons (for Implementation Library and Koloboke Compile)' 4 | 5 | dependencies { 6 | compile project("$parent.path:api") 7 | } 8 | 9 | compileCompatibility(compileTestJava, 1.8) -------------------------------------------------------------------------------- /lib/impl-common/findbugs/config/excludeFilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/AbstractEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl; 18 | 19 | import java.util.Map; 20 | 21 | 22 | public abstract class AbstractEntry implements Map.Entry { 23 | 24 | @Override 25 | public V setValue(V value) { 26 | throw new UnsupportedOperationException(); 27 | } 28 | 29 | @Override 30 | public abstract int hashCode(); 31 | 32 | @Override 33 | public abstract boolean equals(Object o); 34 | 35 | @Override 36 | public String toString() { 37 | return getKey() + "=" + getValue(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/AbstractSetView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import java.util.Set; 21 | 22 | 23 | public abstract class AbstractSetView extends AbstractView implements Set { 24 | 25 | public abstract int hashCode(); 26 | 27 | @Override 28 | public final boolean equals(Object obj) { 29 | return CommonSetOps.equals(this, obj); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/CommonMapOps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import javax.annotation.Nonnull; 21 | 22 | import java.util.Map; 23 | 24 | 25 | public final class CommonMapOps { 26 | 27 | @SuppressWarnings("unchecked") 28 | public static boolean equals(@Nonnull InternalMapOps map, Object obj) { 29 | if (map == obj) { return true; } 30 | if (!(obj instanceof Map)) { 31 | return false; 32 | } 33 | Map that = (Map) obj; 34 | if (that.size() != map.size()) { return false; } 35 | try { 36 | return map.containsAllEntries(that); 37 | } catch (ClassCastException e) { 38 | return false; 39 | } catch (NullPointerException e) { 40 | return false; 41 | } 42 | } 43 | 44 | 45 | private CommonMapOps() {} 46 | } 47 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/CommonSetOps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import javax.annotation.Nonnull; 21 | 22 | import java.util.Set; 23 | 24 | 25 | public final class CommonSetOps { 26 | 27 | public static boolean equals(@Nonnull Set set, Object obj) { 28 | if (set == obj) 29 | return true; 30 | if (!(obj instanceof Set)) 31 | return false; 32 | Set another = (Set) obj; 33 | if (another.size() != set.size()) 34 | return false; 35 | try { 36 | return set.containsAll(another); 37 | } catch (ClassCastException e) { 38 | return false; 39 | } catch (NullPointerException e) { 40 | return false; 41 | } 42 | } 43 | 44 | 45 | private CommonSetOps() {} 46 | } 47 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/Containers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl; 18 | 19 | import com.koloboke.collect.Container; 20 | 21 | import java.util.Collection; 22 | import java.util.Map; 23 | 24 | 25 | public final class Containers { 26 | 27 | public static long sizeAsLong(Collection c) { 28 | return c instanceof Container ? ((Container) c).sizeAsLong() : (long) c.size(); 29 | } 30 | 31 | public static long sizeAsLong(Map m) { 32 | return m instanceof Container ? ((Container) m).sizeAsLong() : (long) m.size(); 33 | } 34 | 35 | public static int sizeAsInt(long size) { 36 | return size <= (long) Integer.MAX_VALUE ? (int) size : Integer.MAX_VALUE; 37 | } 38 | 39 | private Containers() {} 40 | } 41 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/InternalMapOps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import java.util.Map; 21 | 22 | 23 | public interface InternalMapOps extends Map { 24 | 25 | boolean containsAllEntries(Map map); 26 | } 27 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/Maths.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl; 18 | 19 | public final class Maths { 20 | 21 | /** 22 | * Checks if the given number is a positive power of 2 (including zero power - one). 23 | * 24 | * @param n the number to check 25 | * @return {@code true} is the number is equal to 1, 2, 4, ... or 2^30 26 | */ 27 | public static boolean isPowerOf2(int n) { 28 | return (n & (n - 1)) == 0; 29 | } 30 | 31 | /** 32 | * Checks if the given number is a positive power of 2 (including zero power - one). 33 | * 34 | * @param n the number to check 35 | * @return {@code true} is the number is equal to 1, 2, 4, ... or 2^62 36 | */ 37 | public static boolean isPowerOf2(long n) { 38 | return (n & (n - 1L)) == 0; 39 | } 40 | 41 | private Maths() {} 42 | } 43 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/PrimitiveConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl; 18 | 19 | public interface PrimitiveConstants { 20 | public static final int BYTE_CARDINALITY = 1 << 8; 21 | public static final int BYTE_MASK = 0xFF; 22 | /** 23 | * A prime slightly greater than {@link #BYTE_CARDINALITY} / 3. 24 | */ 25 | public static final int BYTE_PERMUTATION_STEP = 97; 26 | 27 | public static final int SHORT_CARDINALITY = 1 << 16; 28 | public static final int SHORT_MASK = 0xFFFF; 29 | public static final int SHORT_PERMUTATION_STEP = 21859; 30 | 31 | public static final int CHAR_CARDINALITY = 1 << 16; 32 | public static final int CHAR_PERMUTATION_STEP = 21859; 33 | 34 | public static final long INT_MASK = 0xFFFFFFFFL; 35 | public static final long FLOAT_MASK = INT_MASK; 36 | } 37 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/hash/Hash.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl.hash; 18 | 19 | import com.koloboke.collect.hash.HashContainer; 20 | 21 | 22 | public interface Hash extends HashContainer { 23 | 24 | HashConfigWrapper configWrapper(); 25 | 26 | int capacity(); 27 | 28 | int freeSlots(); 29 | 30 | boolean noRemoved(); 31 | 32 | int removedSlots(); 33 | 34 | int modCount(); 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/hash/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * This package (and its subpackages) contain internal implementations. These 19 | * classes should not be accessed directly (treat them like {@code com.sun} classes). 20 | * 21 | *

Advice: exclude this package and all subpackages from the auto-complete in your favourite IDE: 22 | * IDEA, 23 | * Eclipse, etc. 24 | * 25 | *

Annotation {@link javax.annotation.ParametersAreNonnullByDefault} on this package added to 26 | * suppress warnings in API about not annotated method implementations. It doesn't mean that all 27 | * parameters in the package are really nonnull by default. 28 | */ 29 | @javax.annotation.ParametersAreNonnullByDefault 30 | package com.koloboke.collect.impl.hash; -------------------------------------------------------------------------------- /lib/impl-common/src/main/java/com/koloboke/collect/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * This package (and its subpackages) contain internal implementations. These 19 | * classes should not be accessed directly (treat them like {@code com.sun} classes). 20 | * 21 | *

Advice: exclude this package and all subpackages from the auto-complete in your favourite IDE: 22 | * IDEA, 23 | * Eclipse, etc. 24 | * 25 | *

Annotation {@link javax.annotation.ParametersAreNonnullByDefault} on this package added to 26 | * suppress warnings in API about not annotated method implementations. It doesn't mean that all 27 | * parameters in the package are really nonnull by default. 28 | */ 29 | @javax.annotation.ParametersAreNonnullByDefault 30 | package com.koloboke.collect.impl; -------------------------------------------------------------------------------- /lib/impl-common/src/main/javaTemplates/com/koloboke/collect/impl/AbstractByteKeyView.java: -------------------------------------------------------------------------------- 1 | /* with byte|char|short|int|long|float|double|obj key */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import com.koloboke.collect.set.ByteSet; 21 | import javax.annotation.Nonnull; 22 | 23 | import java.util.Collection; 24 | 25 | 26 | public abstract class AbstractByteKeyView/*<>*/ extends AbstractSetView 27 | implements ByteSet/*<>*/, InternalByteCollectionOps/*<>*/ { 28 | 29 | @Override 30 | public final boolean containsAll(@Nonnull Collection c) { 31 | return CommonByteCollectionOps.containsAll(this, c); 32 | } 33 | 34 | /* if !(obj key) */ 35 | @Override 36 | public final boolean add(byte e) { 37 | throw new UnsupportedOperationException(); 38 | } 39 | 40 | /* if float|double key */ 41 | @Override 42 | public final boolean add(/* bits */byte bits) { 43 | throw new UnsupportedOperationException(); 44 | } 45 | /* endif */ 46 | /* endif */ 47 | } 48 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/javaTemplates/com/koloboke/collect/impl/AbstractShortValueView.java: -------------------------------------------------------------------------------- 1 | /* with short|byte|char|int|long|float|double|obj value */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import com.koloboke.collect.ShortCollection; 21 | import javax.annotation.Nonnull; 22 | 23 | import java.util.Collection; 24 | 25 | 26 | public abstract class AbstractShortValueView/*<>*/ extends AbstractView 27 | implements ShortCollection/*<>*/, InternalShortCollectionOps/*<>*/ { 28 | 29 | @Override 30 | public final boolean containsAll(@Nonnull Collection c) { 31 | return CommonShortCollectionOps.containsAll(this, c); 32 | } 33 | 34 | /* if !(obj value) */ 35 | @Override 36 | public final boolean add(short e) { 37 | throw new UnsupportedOperationException(); 38 | } 39 | 40 | /* if float|double value */ 41 | @Override 42 | public final boolean add(/* bits */short bits) { 43 | throw new UnsupportedOperationException(); 44 | } 45 | /* endif */ 46 | /* endif */ 47 | } 48 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/javaTemplates/com/koloboke/collect/impl/InternalByteCollectionOps.java: -------------------------------------------------------------------------------- 1 | /* with byte|char|short|int|long|float|double|obj elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import com.koloboke.collect.ByteCollection; 21 | import com.koloboke.collect.set.ByteSet; 22 | 23 | 24 | public interface InternalByteCollectionOps/*<>*/ extends ByteCollection/*<>*/ { 25 | 26 | /* if float|double elem */ 27 | boolean contains(/* bits */byte bits); 28 | 29 | boolean add(/* bits */byte bits); 30 | 31 | boolean removeByte(/* bits */byte bits); 32 | /* endif */ 33 | 34 | boolean allContainingIn(ByteCollection/**/ c); 35 | 36 | boolean reverseAddAllTo(ByteCollection/**/ c); 37 | 38 | boolean reverseRemoveAllFrom(ByteSet/**/ s); 39 | } 40 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/javaTemplates/com/koloboke/collect/impl/InternalByteShortMapOps.java: -------------------------------------------------------------------------------- 1 | /* with 2 | byte|char|short|int|long|float|double|obj key 3 | short|byte|char|int|long|float|double|obj value 4 | */ 5 | /* 6 | * Copyright 2014 the original author or authors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package com.koloboke.collect.impl; 22 | 23 | import com.koloboke.collect.map.ByteShortMap; 24 | 25 | 26 | public interface InternalByteShortMapOps/*<>*/ 27 | extends ByteShortMap/*<>*/, InternalMapOps { 28 | 29 | boolean containsEntry(/* raw */byte key, /* raw */short value); 30 | 31 | void justPut(byte key, short value); 32 | 33 | /* if float|double key || float|double value */ 34 | boolean containsEntry(/* bits *//* raw */byte key, /* bits *//* raw */short value); 35 | 36 | void justPut(/* bits */byte key, /* bits */short value); 37 | /* endif */ 38 | 39 | boolean allEntriesContainingIn(InternalByteShortMapOps/**/ map); 40 | 41 | void reversePutAllTo(InternalByteShortMapOps/**/ map); 42 | } 43 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/javaTemplates/com/koloboke/collect/impl/SupportedJdkVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl; 18 | 19 | public final class SupportedJdkVersion { 20 | 21 | public static final int SUPPORTED_JDK_VERSION = 22 | /* if JDK6 jdk */6/* elif JDK8 jdk //8// endif */; 23 | 24 | private SupportedJdkVersion() {} 25 | } 26 | -------------------------------------------------------------------------------- /lib/impl-common/src/main/javaTemplates/com/koloboke/collect/impl/ThreadLocalRandom.java: -------------------------------------------------------------------------------- 1 | /* if JDK6 jdk */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import java.util.Random; 21 | 22 | 23 | /** 24 | * Placeholder of {@link java.util.concurrent.ThreadLocalRandom} for Java 6. 25 | */ 26 | public final class ThreadLocalRandom { 27 | 28 | private static final ThreadLocal threadLocal = new ThreadLocal() { 29 | @Override 30 | protected Random initialValue() { 31 | return new Random(); 32 | } 33 | }; 34 | 35 | public static Random current() { 36 | return threadLocal.get(); 37 | } 38 | 39 | private ThreadLocalRandom() {} 40 | } 41 | -------------------------------------------------------------------------------- /lib/impl-generator/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 8 | } 9 | } 10 | 11 | apply plugin: 'kotlin' 12 | 13 | setSourceCompatibility(1.6) 14 | 15 | dependencies { 16 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 17 | compile project(':jpsg:core') 18 | } 19 | 20 | configurePublishing(project) 21 | version = meta_projects_version 22 | archivesBaseName = "koloboke-$project.name" 23 | poms*.whenConfigured { pom -> 24 | pom.project { 25 | name = "Koloboke Collections Implementation Methods Generator" 26 | } 27 | } -------------------------------------------------------------------------------- /lib/impl-generator/findbugs/config/excludeFilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/Method.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect; 18 | 19 | 20 | public interface Method { 21 | 22 | void init(MethodGenerator g, MethodContext c); 23 | 24 | Class generatorBase(); 25 | } 26 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/Permission.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect; 18 | 19 | public enum Permission { 20 | INSERT, 21 | REMOVE, 22 | SET_VALUE, 23 | CLEAR 24 | } 25 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/algo/hash/Index.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.algo.hash; 18 | 19 | import com.koloboke.jpsg.collect.mapqu.BasicMapQueryUpdateOp; 20 | import com.koloboke.jpsg.collect.mapqu.MapQueryUpdateMethod; 21 | 22 | 23 | public final class Index extends MapQueryUpdateMethod { 24 | 25 | @Override 26 | public BasicMapQueryUpdateOp baseOp() { 27 | return BasicMapQueryUpdateOp.GET; 28 | } 29 | 30 | @Override 31 | public void ifPresent() { 32 | gen.ret(((HashMapQueryUpdateMethodGenerator) gen).indexF()); 33 | } 34 | 35 | @Override 36 | public void ifAbsent() { 37 | gen.ret("-1"); 38 | } 39 | 40 | @Override 41 | public boolean inline() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/algo/hash/Insert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.algo.hash; 18 | 19 | import com.koloboke.jpsg.collect.mapqu.*; 20 | 21 | 22 | public final class Insert extends MapQueryUpdateMethod { 23 | 24 | @Override 25 | public BasicMapQueryUpdateOp baseOp() { 26 | return BasicMapQueryUpdateOp.CUSTOM_INSERT; 27 | } 28 | 29 | @Override 30 | public Branch mostProbableBranch() { 31 | return Branch.KEY_ABSENT; 32 | } 33 | 34 | @Override 35 | public void ifPresent() { 36 | gen.ret(((HashMapQueryUpdateMethodGenerator) gen).indexF()); 37 | } 38 | 39 | @Override 40 | public void ifAbsent() { 41 | gen.insert("value"); 42 | gen.ret("-1"); 43 | } 44 | 45 | @Override 46 | public boolean inline() { 47 | return true; 48 | } 49 | 50 | @Override 51 | public String nullArgs() { 52 | return cxt.isMapView() ? "value" : ""; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/algo/hash/TableType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.algo.hash; 18 | 19 | import com.koloboke.jpsg.PrimitiveType; 20 | import com.koloboke.jpsg.function.UnaryOperator; 21 | 22 | import static com.koloboke.jpsg.PrimitiveType.CHAR; 23 | import static com.koloboke.jpsg.PrimitiveType.INT; 24 | import static com.koloboke.jpsg.PrimitiveType.LONG; 25 | 26 | 27 | enum TableType implements UnaryOperator { 28 | INSTANCE; 29 | 30 | @Override 31 | public PrimitiveType apply(PrimitiveType primitiveType) { 32 | switch (primitiveType) { 33 | case BYTE: return CHAR; 34 | case CHAR: case SHORT: return INT; 35 | default: return LONG; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/algo/hash/TableTypeDimFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.algo.hash; 18 | 19 | import com.koloboke.jpsg.function.Predicate; 20 | 21 | 22 | enum TableTypeDimFilter implements Predicate { 23 | INSTANCE; 24 | 25 | @Override 26 | public boolean test(String dim) { 27 | return "key".equals(dim) || "elem".equals(dim); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/algo/hash/TableTypePostProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.algo.hash; 18 | 19 | import com.koloboke.jpsg.BitsModifierPostProcessor; 20 | import com.koloboke.jpsg.PrimitiveTypeModifierPostProcessor; 21 | 22 | 23 | public final class TableTypePostProcessor extends PrimitiveTypeModifierPostProcessor { 24 | 25 | public TableTypePostProcessor() { 26 | super("tt", TableType.INSTANCE, TableTypeDimFilter.INSTANCE); 27 | } 28 | 29 | @Override 30 | public int priority() { 31 | return BitsModifierPostProcessor.getPRIORITY() + 5; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/algo/hash/TableTypePreProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.algo.hash; 18 | 19 | import com.koloboke.jpsg.BitsModifierPreProcessor; 20 | import com.koloboke.jpsg.PrimitiveTypeModifierPreProcessor; 21 | 22 | 23 | public final class TableTypePreProcessor extends PrimitiveTypeModifierPreProcessor { 24 | 25 | public TableTypePreProcessor() { 26 | super("tt", TableType.INSTANCE, TableTypeDimFilter.INSTANCE); 27 | } 28 | 29 | @Override 30 | public int priority() { 31 | return BitsModifierPreProcessor.getPRIORITY() - 5; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/BulkMethodGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | import com.koloboke.jpsg.collect.MethodGenerator; 20 | 21 | 22 | public abstract class BulkMethodGenerator extends MethodGenerator { 23 | 24 | public String keyAndValue() { 25 | return key() + ", " + value(); 26 | } 27 | 28 | public abstract String key(); 29 | 30 | public abstract String unwrappedKey(); 31 | 32 | public abstract String value(); 33 | 34 | public abstract String unwrappedValue(); 35 | 36 | public abstract MethodGenerator remove(); 37 | 38 | public abstract MethodGenerator setValue(String newValue); 39 | 40 | public abstract String viewValues(); 41 | 42 | public abstract String viewElem(); 43 | 44 | public abstract BulkMethodGenerator clear(); 45 | } 46 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/EntryType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public enum EntryType { 20 | SIMPLE, 21 | REUSABLE 22 | } 23 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ForEach.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class ForEach extends BulkMethod { 20 | 21 | @Override 22 | public void beginning() { 23 | gen.requireNonNull("action"); 24 | escapeIfEmpty(); 25 | } 26 | 27 | @Override 28 | public void loopBody() { 29 | gen.lines("action.accept(" + gen.viewValues() + ");"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ForEachWhile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class ForEachWhile extends BulkMethod { 20 | 21 | @Override 22 | public void beginning() { 23 | gen.requireNonNull("predicate"); 24 | gen.lines( 25 | "if (this.isEmpty())", 26 | " return true;", 27 | "boolean terminated = false;" 28 | ); 29 | } 30 | 31 | @Override 32 | public void loopBody() { 33 | gen.ifBlock("!predicate.test(" + gen.viewValues() + ")"); 34 | gen.lines( 35 | "terminated = true;", 36 | "break;" 37 | ).blockEnd(); 38 | } 39 | 40 | @Override 41 | public void end() { 42 | gen.ret("!terminated"); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ListHashCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class ListHashCode extends HashCode { 20 | 21 | @Override 22 | int initialValue() { 23 | return 1; 24 | } 25 | 26 | @Override 27 | String aggregate(String elemHash) { 28 | return "hashCode = 31 * hashCode + " + elemHash; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/RemoveAll.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class RemoveAll extends BulkRemoveUsingAnotherCollection { 20 | 21 | @Override 22 | public void beginning() { 23 | super.beginning(); 24 | gen.lines( 25 | "if (this.isEmpty() || c.isEmpty())", 26 | " return false;", 27 | "boolean changed = false;" 28 | ); 29 | } 30 | 31 | @Override 32 | public void loopBody() { 33 | gen.ifBlock("c.contains(" + gen.viewValues() + ")"); 34 | gen.remove(); 35 | gen.lines("changed = true;"); 36 | gen.blockEnd(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/RemoveIf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class RemoveIf extends BulkMethod { 20 | 21 | @Override 22 | public void beginning() { 23 | gen.requireNonNull("filter"); 24 | gen.lines( 25 | "if (this.isEmpty())", 26 | " return false;", 27 | "boolean changed = false;" 28 | ); 29 | } 30 | 31 | @Override 32 | public void loopBody() { 33 | gen.ifBlock("filter.test(" + gen.viewValues() + ")"); 34 | gen.remove(); 35 | gen.lines("changed = true;"); 36 | gen.blockEnd(); 37 | } 38 | 39 | @Override 40 | public void end() { 41 | gen.ret("changed"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ReplaceAll.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | 20 | public final class ReplaceAll extends BulkMethod { 21 | 22 | @Override 23 | public void beginning() { 24 | gen.requireNonNull("function"); 25 | escapeIfEmpty(); 26 | } 27 | 28 | @Override 29 | public void loopBody() { 30 | gen.setValue("function." + cxt.applyValueName() + "(" + gen.viewValues() + ")"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/RetainAll.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class RetainAll extends BulkRemoveUsingAnotherCollection { 20 | 21 | @Override 22 | public void beginning() { 23 | super.beginning(); 24 | gen.lines( 25 | "if (this.isEmpty())", 26 | " return false;" 27 | ); 28 | gen.lines("if (c.isEmpty())").block(); 29 | gen.clear(); 30 | gen.ret(true); 31 | gen.blockEnd(); 32 | gen.lines("boolean changed = false;"); 33 | } 34 | 35 | @Override 36 | public void loopBody() { 37 | gen.ifBlock("!c.contains(" + gen.viewValues() + ")"); 38 | gen.remove(); 39 | gen.lines("changed = true;"); 40 | gen.blockEnd(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ReverseAddAllTo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class ReverseAddAllTo extends BulkMethod { 20 | 21 | @Override 22 | public boolean withInternalVersion() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public void beginning() { 28 | gen.lines( 29 | "if (this.isEmpty())", 30 | " return false;", 31 | "boolean changed = false;" 32 | ); 33 | } 34 | 35 | @Override 36 | public void loopBody() { 37 | gen.lines("changed |= c.add(" + gen.viewElem() + ");"); 38 | } 39 | 40 | @Override 41 | public void end() { 42 | gen.ret("changed"); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ReversePutAllTo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class ReversePutAllTo extends BulkMethod { 20 | 21 | @Override 22 | public boolean withInternalVersion() { 23 | return true; 24 | } 25 | 26 | @Override 27 | public void beginning() { 28 | escapeIfEmpty(); 29 | } 30 | 31 | @Override 32 | public void loopBody() { 33 | gen.lines("m.justPut(" + gen.keyAndValue() + ");"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/SetHashCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | public final class SetHashCode extends HashCode { 20 | 21 | @Override 22 | int initialValue() { 23 | return 0; 24 | } 25 | 26 | @Override 27 | String aggregate(String elemHash) { 28 | return "hashCode += " + elemHash; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/bulk/ToArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.bulk; 18 | 19 | import com.koloboke.jpsg.PrimitiveType; 20 | 21 | 22 | public final class ToArray extends BulkMethod { 23 | 24 | @Override 25 | public void beginning() { 26 | String arrayType = "Object"; 27 | if (cxt.isPrimitiveView() && !cxt.genericVersion()) { 28 | arrayType = ((PrimitiveType) cxt.viewOption()).standalone; 29 | } 30 | gen.lines( 31 | "int size = size();", 32 | arrayType + "[] result = new " + arrayType + "[size];", 33 | "if (size == 0)", 34 | " return result;", 35 | "int resultIndex = 0;" 36 | ); 37 | } 38 | 39 | @Override 40 | public void loopBody() { 41 | gen.lines("result[resultIndex++] = " + gen.viewElem() + ";"); 42 | } 43 | 44 | @Override 45 | public void end() { 46 | gen.ret("result"); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/iter/IterMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.iter; 18 | 19 | import com.koloboke.jpsg.collect.*; 20 | 21 | 22 | public enum IterMethod implements Method { 23 | FIELDS, CONSTRUCTOR, HAS_NEXT, MOVE_NEXT, NEXT, ELEM, KEY, VALUE, SET_VALUE, REMOVE, 24 | FOR_EACH_REMAINING, FOR_EACH_FORWARD; 25 | 26 | public static IterMethod forName(String name) { 27 | for (IterMethod method : values()) { 28 | if (method.name().replace("_", "").equalsIgnoreCase(name)) { 29 | return method; 30 | } 31 | } 32 | throw new RuntimeException("Unknown method: " + name); 33 | } 34 | 35 | @Override 36 | public void init(MethodGenerator g, MethodContext c) { 37 | } 38 | 39 | @Override 40 | public Class generatorBase() { 41 | throw new UnsupportedOperationException(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/Add.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class Add extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.CUSTOM_INSERT; 24 | } 25 | 26 | @Override 27 | public Branch mostProbableBranch() { 28 | return Branch.KEY_ABSENT; 29 | } 30 | 31 | @Override 32 | public void ifPresent() { 33 | gen.ret(false); 34 | } 35 | 36 | @Override 37 | public void ifAbsent() { 38 | gen.insert("unused"); 39 | gen.ret(true); 40 | } 41 | 42 | @Override 43 | public boolean inline() { 44 | return true; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/AddValueWithInitial.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class AddValueWithInitial extends AddValue { 20 | 21 | @Override 22 | String toAdd() { 23 | return "addition"; 24 | } 25 | 26 | @Override 27 | String initialValue() { 28 | return "initialValue"; 29 | } 30 | 31 | @Override 32 | public String nullArgs() { 33 | return "addition, initialValue"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/BasicMapQueryUpdateOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public enum BasicMapQueryUpdateOp { 20 | GET, 21 | INSERT, 22 | CUSTOM_INSERT 23 | } 24 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/Branch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public enum Branch { 20 | KEY_PRESENT, 21 | KEY_ABSENT 22 | } 23 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/ComputeIfPresent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class ComputeIfPresent extends Compute { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | if (cxt.isObjectValue()) 29 | gen.ifBlock(gen.value() + " != null"); 30 | super.ifPresent(); 31 | if (cxt.isObjectValue()) { 32 | gen.elseBlock(); { 33 | gen.ret("null"); 34 | } gen.blockEnd(); 35 | } 36 | } 37 | 38 | @Override 39 | public void ifAbsent() { 40 | gen.ret(gen.defaultValue()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/ContainsEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class ContainsEntry extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.ret(gen.valueEquals("value")); 29 | } 30 | 31 | @Override 32 | public void ifAbsent() { 33 | gen.ret(false); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/ContainsKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class ContainsKey extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.ret(true); 29 | } 30 | 31 | @Override 32 | public void ifAbsent() { 33 | gen.ret(false); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/Get.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class Get extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.ret(gen.value()); 29 | } 30 | 31 | @Override 32 | public void ifAbsent() { 33 | gen.ret(gen.defaultValue()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/GetOrDefault.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class GetOrDefault extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.ret(gen.value()); 29 | } 30 | 31 | @Override 32 | public void ifAbsent() { 33 | gen.ret("defaultValue"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/JustPut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class JustPut extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.INSERT; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.setValue("value"); 29 | gen.lines("return;"); 30 | } 31 | 32 | @Override 33 | public void ifAbsent() { 34 | gen.lines("return;"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/JustRemove.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class JustRemove extends RemoveLike { 20 | 21 | @Override 22 | public void ifPresent() { 23 | gen.remove(); 24 | gen.ret(true); 25 | } 26 | 27 | @Override 28 | public void ifAbsent() { 29 | gen.ret(false); 30 | } 31 | 32 | @Override 33 | public String nullArgs() { 34 | return ""; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/MapQueryUpdateMethodGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | import com.koloboke.jpsg.collect.MethodGenerator; 20 | 21 | 22 | public abstract class MapQueryUpdateMethodGenerator extends MethodGenerator { 23 | 24 | public String keyAndValue() { 25 | return key() + ", " + value(); 26 | } 27 | 28 | public abstract String key(); 29 | 30 | public abstract String value(); 31 | 32 | public abstract MethodGenerator remove(); 33 | 34 | public abstract MethodGenerator setValue(String newValue); 35 | 36 | public abstract String defaultValue(); 37 | 38 | public abstract String valueEquals(String valueToCompare); 39 | 40 | public abstract void insert(String value); 41 | } 42 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/Put.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class Put extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.INSERT; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.lines(cxt.valueType() + " prevValue = " + gen.value() + ";"); 29 | gen.setValue("value"); 30 | gen.ret("prevValue"); 31 | } 32 | 33 | @Override 34 | public void ifAbsent() { 35 | gen.ret(gen.defaultValue()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/PutIfAbsent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class PutIfAbsent extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.INSERT; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.ret(gen.value()); 29 | } 30 | 31 | @Override 32 | public void ifAbsent() { 33 | gen.ret(gen.defaultValue()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/Remove.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class Remove extends RemoveLike { 20 | 21 | @Override 22 | public void ifPresent() { 23 | if (cxt.isMapView()) { 24 | gen.lines(cxt.valueType() + " val = " + gen.value() + ";"); 25 | gen.remove(); 26 | gen.ret("val"); 27 | } else { 28 | gen.remove(); 29 | gen.ret(true); 30 | } 31 | } 32 | 33 | @Override 34 | public void ifAbsent() { 35 | gen.ret(cxt.isMapView() ? gen.defaultValue() : "false"); 36 | } 37 | 38 | @Override 39 | public String nullArgs() { 40 | return ""; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/RemoveEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class RemoveEntry extends RemoveLike { 20 | 21 | @Override 22 | public void ifPresent() { 23 | gen.ifBlock(gen.valueEquals("value")); 24 | gen.remove(); 25 | gen.ret(true); 26 | gen.elseBlock(); 27 | gen.ret(false); 28 | gen.blockEnd(); 29 | } 30 | 31 | @Override 32 | public void ifAbsent() { 33 | gen.ret(false); 34 | } 35 | 36 | @Override 37 | public String nullArgs() { 38 | return "value"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/RemoveLike.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | abstract class RemoveLike extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public final BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public final boolean removeIsHighlyProbable() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean inline() { 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/Replace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class Replace extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.lines(cxt.valueType() + " oldValue = " + gen.value() + ";"); 29 | gen.setValue("value"); 30 | gen.ret("oldValue"); 31 | } 32 | 33 | @Override 34 | public void ifAbsent() { 35 | gen.ret(gen.defaultValue()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/impl-generator/src/main/java/com/koloboke/jpsg/collect/mapqu/ReplaceEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.jpsg.collect.mapqu; 18 | 19 | public final class ReplaceEntry extends MapQueryUpdateMethod { 20 | 21 | @Override 22 | public BasicMapQueryUpdateOp baseOp() { 23 | return BasicMapQueryUpdateOp.GET; 24 | } 25 | 26 | @Override 27 | public void ifPresent() { 28 | gen.ifBlock(gen.valueEquals("oldValue")); 29 | gen.setValue("newValue"); 30 | gen.ret(true); 31 | gen.elseBlock(); 32 | gen.ret(false); 33 | gen.blockEnd(); 34 | } 35 | 36 | @Override 37 | public void ifAbsent() { 38 | gen.ret(false); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/impl/findbugs/config/excludeFilter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/impl/src/main/java/com/koloboke/collect/impl/AbstractContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.impl; 19 | 20 | import com.koloboke.collect.Container; 21 | 22 | 23 | public abstract class AbstractContainer implements Container { 24 | 25 | @Override 26 | public int size() { 27 | return Containers.sizeAsInt(sizeAsLong()); 28 | } 29 | 30 | @Override 31 | public long sizeAsLong() { 32 | return (long) size(); 33 | } 34 | 35 | public final boolean isEmpty() { 36 | return size() == 0; 37 | } 38 | 39 | @Override 40 | public abstract boolean equals(Object o); 41 | 42 | @Override 43 | public abstract int hashCode(); 44 | 45 | @Override 46 | public abstract String toString(); 47 | } 48 | -------------------------------------------------------------------------------- /lib/impl/src/main/java/com/koloboke/collect/impl/NotGenerated.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl; 18 | 19 | public class NotGenerated extends RuntimeException { 20 | private static final long serialVersionUID = 0L; 21 | } 22 | -------------------------------------------------------------------------------- /lib/impl/src/main/java/com/koloboke/collect/impl/hash/HashWithoutRemovedSlots.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl.hash; 18 | 19 | import com.koloboke.collect.hash.HashConfig; 20 | import com.koloboke.collect.impl.AbstractContainer; 21 | 22 | import javax.annotation.Nonnull; 23 | 24 | 25 | public abstract class HashWithoutRemovedSlots extends AbstractContainer implements Hash { 26 | 27 | @Nonnull 28 | @Override 29 | public final HashConfig hashConfig() { 30 | return configWrapper().config(); 31 | } 32 | 33 | @Override 34 | public final boolean noRemoved() { 35 | return true; 36 | } 37 | 38 | @Override 39 | public final int freeSlots() { 40 | return capacity() - size(); 41 | } 42 | 43 | @Override 44 | public final int removedSlots() { 45 | return 0; 46 | } 47 | 48 | @Override 49 | public final double currentLoad() { 50 | return ((double) size()) / (double) capacity(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/impl/src/main/java/com/koloboke/collect/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * This package (and its subpackages) contain internal implementations. These 19 | * classes should not be accessed directly (treat them like {@code com.sun} classes). 20 | * 21 | *

Advice: exclude this package and all subpackages from the auto-complete in your favourite IDE: 22 | * IDEA, 23 | * Eclipse, etc. 24 | * 25 | *

Annotation {@link javax.annotation.ParametersAreNonnullByDefault} on this package added to 26 | * suppress warnings in API about not annotated method implementations. It doesn't mean that all 27 | * parameters in the package are really nonnull by default. 28 | */ 29 | @javax.annotation.ParametersAreNonnullByDefault 30 | package com.koloboke.collect.impl; -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/ByteHash.java: -------------------------------------------------------------------------------- 1 | /* with byte|char|short|int|long elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl.hash; 19 | 20 | 21 | interface ByteHash extends Hash { 22 | 23 | byte freeValue(); 24 | 25 | boolean supportRemoved(); 26 | 27 | /** 28 | * @throws java.lang.UnsupportedOperationException 29 | */ 30 | byte removedValue(); 31 | } 32 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/DoubleHash.java: -------------------------------------------------------------------------------- 1 | /* with double|float elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl.hash; 19 | 20 | 21 | interface DoubleHash extends Hash { 22 | static final long FREE_BITS = Long.MAX_VALUE - 1, REMOVED_BITS = Long.MAX_VALUE; 23 | } 24 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/DoubleHashFactorySO.java: -------------------------------------------------------------------------------- 1 | /* with double|float elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl.hash; 19 | 20 | import com.koloboke.collect.hash.HashConfig; 21 | 22 | 23 | abstract class DoubleHashFactorySO extends AbstractHashFactory { 24 | 25 | DoubleHashFactorySO(HashConfig hashConf, int defaultExpectedSize) { 26 | super(hashConf, defaultExpectedSize); 27 | } 28 | 29 | String keySpecialString() { 30 | return ""; 31 | } 32 | 33 | int keySpecialHashCode(int hashCode) { 34 | return hashCode; 35 | } 36 | 37 | @SuppressWarnings("unused") 38 | boolean keySpecialEquals(Object other) { 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/ObjHash.java: -------------------------------------------------------------------------------- 1 | /* with obj elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl.hash; 19 | 20 | 21 | interface ObjHash extends Hash { 22 | static final Object REMOVED = new Object(), FREE = new Object(); 23 | } 24 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/ObjHashFactorySO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.impl.hash; 18 | 19 | import com.koloboke.collect.Equivalence; 20 | import com.koloboke.collect.hash.HashConfig; 21 | 22 | import javax.annotation.Nonnull; 23 | 24 | 25 | abstract class ObjHashFactorySO extends AbstractHashFactory { 26 | 27 | private final boolean isNullAllowed; 28 | 29 | ObjHashFactorySO(HashConfig hashConf, int defaultExpectedSize, boolean isNullAllowed) { 30 | super(hashConf, defaultExpectedSize); 31 | this.isNullAllowed = isNullAllowed; 32 | } 33 | 34 | public boolean isNullKeyAllowed() { 35 | return isNullAllowed; 36 | } 37 | 38 | @Nonnull 39 | abstract Equivalence getEquivalence(); 40 | 41 | int keySpecialHashCode(int hashCode) { 42 | hashCode = hashCode * 31 + getEquivalence().hashCode(); 43 | return hashCode * 31 + (isNullKeyAllowed() ? 1 : 0); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/ParallelKVByteHash.java: -------------------------------------------------------------------------------- 1 | /* with byte|char|short|int|long|float|double|obj elem Parallel kv */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl.hash; 19 | 20 | import javax.annotation.Nonnull; 21 | 22 | 23 | interface ParallelKVByteHash extends ByteHash { 24 | @Nonnull /* if !(obj elem) */char/* elif obj elem //Object// endif */[] table(); 25 | } 26 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/SeparateKVByteDHash.java: -------------------------------------------------------------------------------- 1 | /* with 2 | DHash|QHash|LHash hash 3 | byte|char|short|int|long|float|double|obj elem 4 | Separate|Parallel kv 5 | */ 6 | /* if (Separate kv) || (Enabled parallelKV) */ 7 | /* 8 | * Copyright 2014 the original author or authors. 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | 23 | package com.koloboke.collect.impl.hash; 24 | 25 | 26 | interface SeparateKVByteDHash extends SeparateKVByteHash, DHash { 27 | } 28 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/SeparateKVByteHash.java: -------------------------------------------------------------------------------- 1 | /* with byte|char|short|int|long|float|double|obj elem Separate kv */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.impl.hash; 19 | 20 | import javax.annotation.Nonnull; 21 | 22 | 23 | interface SeparateKVByteHash extends ByteHash { 24 | @Nonnull /* bits *//* raw */byte[] keys(); 25 | } 26 | -------------------------------------------------------------------------------- /lib/impl/src/main/javaTemplates/com/koloboke/collect/impl/hash/SeparateKVByteShortDHash.java: -------------------------------------------------------------------------------- 1 | /* with 2 | DHash|QHash|LHash hash 3 | byte|char|short|int|long|float|double|obj key 4 | short|byte|char|int|long|float|double|obj value 5 | Separate|Parallel kv 6 | */ 7 | /* 8 | * Copyright 2014 the original author or authors. 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | 23 | package com.koloboke.collect.impl.hash; 24 | 25 | import javax.annotation.Nonnull; 26 | 27 | 28 | public interface SeparateKVByteShortDHash extends SeparateKVByteDHash { 29 | /* if Separate kv */ 30 | @Nonnull /* bits *//* raw */short[] valueArray(); 31 | /* endif */ 32 | } 33 | -------------------------------------------------------------------------------- /lib/impl/src/main/resourceTemplates/META-INF/services/com.koloboke.collect.map.hash.HashCharShortMapFactory: -------------------------------------------------------------------------------- 1 | /* with 2 | char|byte|short|int|long|float|double|obj key 3 | short|byte|char|int|long|float|double|obj value 4 | Separate|Parallel kv 5 | */ 6 | com.koloboke.collect.impl.hash.LHashSeparateKVCharShortMapFactoryImpl -------------------------------------------------------------------------------- /lib/impl/src/main/resourceTemplates/META-INF/services/com.koloboke.collect.set.hash.HashCharSetFactory: -------------------------------------------------------------------------------- 1 | /* with char|byte|short|int|long|float|double|obj elem */ 2 | com.koloboke.collect.impl.hash.LHashCharSetFactoryImpl -------------------------------------------------------------------------------- /lib/impl/src/test/java/com/koloboke/collect/hash/HashConfigs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.hash; 18 | 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | 23 | public final class HashConfigs { 24 | 25 | public static List all() { 26 | return Arrays.asList( 27 | HashConfig.getDefault(), 28 | HashConfig.getDefault().withGrowthFactor(1.999) 29 | ); 30 | } 31 | 32 | private HashConfigs() {} 33 | } 34 | -------------------------------------------------------------------------------- /lib/impl/src/test/java/com/koloboke/collect/hash/ObjHashConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package com.koloboke.collect.hash; 19 | 20 | 21 | public interface ObjHashConfig { 22 | > T apply(T factory); 23 | } 24 | -------------------------------------------------------------------------------- /lib/impl/src/test/javaTemplates/com/koloboke/collect/hash/CharHashConfig.java: -------------------------------------------------------------------------------- 1 | /* with char|byte|short|int|long elem */ 2 | /* 3 | * Copyright 2014 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.koloboke.collect.hash; 19 | 20 | public interface CharHashConfig { 21 | > T apply(T factory); 22 | } 23 | -------------------------------------------------------------------------------- /lib/template-processors/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 8 | } 9 | } 10 | 11 | apply plugin: 'kotlin' 12 | 13 | setSourceCompatibility(1.6) 14 | 15 | dependencies { 16 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 17 | compile project(':jpsg:core') 18 | } 19 | 20 | configurePublishing(project) 21 | version = meta_projects_version 22 | archivesBaseName = "koloboke-$project.name" 23 | poms*.whenConfigured { pom -> 24 | pom.project { 25 | name = "JPSG Template Processors for Koloboke Collections" 26 | } 27 | } -------------------------------------------------------------------------------- /lib/testing/build.gradle: -------------------------------------------------------------------------------- 1 | evaluationDependsOn("$parent.path") 2 | 3 | dependencies { 4 | compile project("$parent.path:api") 5 | compile 'com.google.guava:guava-testlib:19.0' 6 | runtime project("$parent.path:impl") 7 | } 8 | 9 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/CursorFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | import java.util.*; 20 | 21 | 22 | /** 23 | * A method supported by implementations of the {@link com.koloboke.collect.Cursor} interface. 24 | * 25 | * @see com.google.common.collect.testing.IteratorFeature 26 | */ 27 | public enum CursorFeature { 28 | SUPPORTS_REMOVE; 29 | 30 | public static final Set UNMODIFIABLE = Collections.emptySet(); 31 | 32 | public static final Set MODIFIABLE = 33 | Collections.unmodifiableSet(EnumSet.allOf(CursorFeature.class)); 34 | } 35 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/CursorKnownOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | public enum CursorKnownOrder { KNOWN_ORDER, UNKNOWN_ORDER } 20 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/CursorTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | import com.koloboke.collect.Cursor; 20 | 21 | 22 | /** 23 | * {@link com.google.common.collect.testing.IteratorTester} ported to test 24 | * collection {@link Cursor cursors}. 25 | */ 26 | public abstract class CursorTester extends AbstractCursorTester { 27 | 28 | public CursorTester(int steps, Iterable features, Iterable expectedElements, 29 | CursorKnownOrder knownOrder) { 30 | super(steps, features, expectedElements, knownOrder, 0, false); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/Iteration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | import com.koloboke.collect.Cursor; 20 | 21 | import java.util.Iterator; 22 | 23 | 24 | public interface Iteration { 25 | public static Iteration of(final Iterator iterator) { 26 | return iterator::next; 27 | } 28 | 29 | public static Iteration of(final Cursor cursor) { 30 | return cursor::moveNext; 31 | } 32 | 33 | void next(); 34 | } 35 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/ObjSamples.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | import com.google.common.collect.testing.SampleElements; 20 | 21 | import java.util.Arrays; 22 | import java.util.List; 23 | 24 | 25 | public final class ObjSamples { 26 | 27 | public static List> allKeys() { 28 | return Arrays.asList( 29 | new SampleElements.Strings(), 30 | new SampleElements.Colliders() 31 | ); 32 | } 33 | 34 | public static List> allValues() { 35 | return Arrays.asList( 36 | (SampleElements) new SampleElements.Strings(), 37 | new SampleElements.Unhashables() 38 | ); 39 | } 40 | 41 | private ObjSamples() {} 42 | } 43 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | import junit.framework.AssertionFailedError; 20 | 21 | import java.lang.reflect.Method; 22 | 23 | 24 | public final class Util { 25 | 26 | public static Method getTestMethod(Class testClass, String methodName) { 27 | try { 28 | return testClass.getMethod(methodName); 29 | } catch (NoSuchMethodException e) { 30 | throw new AssertionError("Could not find method to suppress ", e); 31 | } 32 | } 33 | 34 | /** 35 | * Copy of {@link com.google.common.collect.testing.Helpers#fail(Throwable, Object)} 36 | */ 37 | public static void fail(Throwable cause, Object message) { 38 | AssertionFailedError assertionFailedError = 39 | new AssertionFailedError(String.valueOf(message)); 40 | assertionFailedError.initCause(cause); 41 | throw assertionFailedError; 42 | } 43 | 44 | private Util() {} 45 | } 46 | -------------------------------------------------------------------------------- /lib/testing/src/main/java/com/koloboke/collect/testing/map/MapCursorTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing.map; 18 | 19 | import com.koloboke.collect.Cursor; 20 | import com.koloboke.collect.testing.*; 21 | 22 | import java.util.Map; 23 | 24 | 25 | /** 26 | * {@link com.google.common.collect.testing.IteratorTester} ported to test 27 | * map {@link Cursor cursors}. 28 | */ 29 | public abstract class MapCursorTester 30 | extends AbstractCursorTester, C> { 31 | public MapCursorTester(int steps, Iterable features, 32 | Iterable> expectedElements, CursorKnownOrder knownOrder) { 33 | super(steps, features, expectedElements, knownOrder, 0, false); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/testing/src/main/javaTemplates/com/koloboke/collect/testing/Specials.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.koloboke.collect.testing; 18 | 19 | public final class Specials { 20 | 21 | public static T getObj() { 22 | return null; 23 | } 24 | 25 | /* with double|float t */ 26 | public static double getDouble() { 27 | return Double.NaN; 28 | } 29 | /* endwith */ 30 | 31 | private Specials() {} 32 | } 33 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include 'jpsg:core', 'jpsg:gradle-plugin', 'jpsg:cli' 2 | include 'lib:impl-generator', 'lib:template-processors' 3 | include 'lib:api', 'lib:impl-common', 'lib:impl', 'lib:testing' 4 | include 'compile' 5 | include 'benchmarks:dimensioned-jmh', 'benchmarks:research', 'benchmarks:time-vs-memory' --------------------------------------------------------------------------------