Skip to content

Commit

Permalink
Update class locations (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbressler13 authored Nov 8, 2022
1 parent db4bbcb commit 1217104
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/basic_checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Basic Checks
name: Unit Tests

on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main_checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Main Checks
name: Build and Test

on:
workflow_dispatch:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Kotlin Utils

[![Build and Test](https://github.com/lbressler13/kotlin-utils/actions/workflows/main_checks.yml/badge.svg?branch=main)](https://github.com/lbressler13/kotlin-utils/actions/workflows/main_checks.yml)

A collection of reusable functions, classes, and aliases that can be used across various Kotlin and Android projects.
Android-specific code, such as functions to handle Views, is not included.

Expand Down Expand Up @@ -41,8 +43,7 @@ In general, these can still be associated with a single class, as this package d
│ │ ├── main
│ │ │ ├── kotlin
│ │ │ │ ├── kotlinutils <-- Source code for kotlin-utils module
│ │ │ │ │ ├── classes <-- New classes defined by this package
│ │ │ │ │ ├── general <-- Generic util functions not related to a class
│ │ │ │ │ ├── general <-- Generic util functions and basic classes
│ │ │ │ │ ├── sample <-- Sample of a class that already exists in Kotlin
│ │ │ │ │ ├── sample2
│ │ ├── test
Expand Down
2 changes: 1 addition & 1 deletion kotlin-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "xyz.lbres"
version = "0.3.0"
version = "0.3.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// ktlint-disable filename

package xyz.lbres.kotlinutils.classes.labelled

import xyz.lbres.kotlinutils.general.labelled.Labelled

/**
* Code for the Labelled class has been moved to the general/labelled package.
* This file exists only to avoid breaking existing functionality that uses the class at this path.
*/

typealias Labelled<T> = Labelled<T>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package xyz.lbres.kotlinutils.classes.multiset

/**
* Code related to MultiSets has been moved to the set/multiset package.
* This file exists only to avoid breaking existing functionality that uses the class at this path.
*/

typealias MultiSet<E> = xyz.lbres.kotlinutils.set.multiset.MultiSet<E>
typealias MutableMultiSet<E> = xyz.lbres.kotlinutils.set.multiset.MutableMultiSet<E>
fun <E> multiSetOf(vararg elements: E): xyz.lbres.kotlinutils.set.multiset.MultiSet<E> = xyz.lbres.kotlinutils.set.multiset.multiSetOf(*elements)
fun <E> mutableMultiSetOf(vararg elements: E): xyz.lbres.kotlinutils.set.multiset.MutableMultiSet<E> = xyz.lbres.kotlinutils.set.multiset.mutableMultiSetOf(*elements)
fun <E> emptyMultiSet(): xyz.lbres.kotlinutils.set.multiset.MultiSet<E> = xyz.lbres.kotlinutils.set.multiset.emptyMultiSet()
fun <E> MultiSet(size: Int, init: (Int) -> E): xyz.lbres.kotlinutils.set.multiset.MultiSet<E> = xyz.lbres.kotlinutils.set.multiset.MultiSet(size, init)
fun <E> MutableMultiSet(size: Int, init: (Int) -> E): xyz.lbres.kotlinutils.set.multiset.MutableMultiSet<E> = xyz.lbres.kotlinutils.set.multiset.MutableMultiSet(size, init)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package xyz.lbres.kotlinutils.collection.ext

import xyz.lbres.kotlinutils.classes.multiset.MultiSet
import xyz.lbres.kotlinutils.classes.multiset.MultiSetImpl
import xyz.lbres.kotlinutils.classes.multiset.MutableMultiSet
import xyz.lbres.kotlinutils.classes.multiset.MutableMultiSetImpl
import xyz.lbres.kotlinutils.generic.ext.isNotNull
import xyz.lbres.kotlinutils.generic.ext.isNull
import xyz.lbres.kotlinutils.set.multiset.MultiSet
import xyz.lbres.kotlinutils.set.multiset.MultiSetImpl
import xyz.lbres.kotlinutils.set.multiset.MutableMultiSet
import xyz.lbres.kotlinutils.set.multiset.MutableMultiSetImpl

/**
* Create a MultiSet with the elements in the current collection.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.labelled
package xyz.lbres.kotlinutils.general.labelled

/**
* Class to represent a value with an assigned label
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

/**
* Interface for set that allows multiple occurrences of a value.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

/**
* Set implementation that allows multiple occurrences of the same value.
*/
internal class MultiSetImpl<E> constructor(elements: Collection<E>) : MultiSet<E>, Set<E> {
internal class MultiSetImpl<E> constructor(elements: Collection<E>) : MultiSet<E> {
/**
* Number of elements in set.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

import xyz.lbres.kotlinutils.collection.ext.toMultiSet
import xyz.lbres.kotlinutils.collection.ext.toMutableMultiSet
Expand All @@ -24,7 +24,7 @@ fun <E> mutableMultiSetOf(vararg elements: E): MutableMultiSet<E> = elements.toL
*
* @return [MultiSet<E>]
*/
fun <E> emptyMultiSet(): MultiSet<E> = MultiSetImpl(listOf())
fun <E> emptyMultiSet(): MultiSet<E> = MultiSetImpl(emptyList())

/**
* Create a MultiSet of a given size, using [init] to generate each element in the set.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

/**
* Interface for set that allows multiple occurrences of a value.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

import xyz.lbres.kotlinutils.int.ext.isZero
import java.lang.Integer.min
import kotlin.math.min

/**
* Mutable set implementation that allows multiple occurrences of the same value.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package xyz.lbres.kotlinutils.collection.ext

import xyz.lbres.kotlinutils.classes.multiset.MultiSet
import xyz.lbres.kotlinutils.classes.multiset.MutableMultiSet
import xyz.lbres.kotlinutils.classes.multiset.multiSetOf
import xyz.lbres.kotlinutils.classes.multiset.mutableMultiSetOf
import xyz.lbres.kotlinutils.set.multiset.MultiSet
import xyz.lbres.kotlinutils.set.multiset.MutableMultiSet
import xyz.lbres.kotlinutils.set.multiset.multiSetOf
import xyz.lbres.kotlinutils.set.multiset.mutableMultiSetOf
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.lbres.kotlinutils.classes.multiset
package xyz.lbres.kotlinutils.set.multiset

import kotlin.test.assertEquals

Expand Down

0 comments on commit 1217104

Please sign in to comment.