Skip to content

Commit

Permalink
Preparation for v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMatthewLayton committed Feb 21, 2021
1 parent 157ea95 commit ae96920
Show file tree
Hide file tree
Showing 35 changed files with 554 additions and 91 deletions.
16 changes: 0 additions & 16 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
}

group 'io.onixlabs'
version '1.0.0'
version '1.0.0-rc1'

allprojects {
repositories {
Expand Down
18 changes: 17 additions & 1 deletion src/main/kotlin/io/onixlabs/kotlin/core/ConsoleColor.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

/**
Expand Down Expand Up @@ -102,4 +118,4 @@ enum class ConsoleColor(internal val code: Int) {
*/
@Suppress(UNUSED)
LIGHT_GRAY(37)
}
}
18 changes: 17 additions & 1 deletion src/main/kotlin/io/onixlabs/kotlin/core/ConsoleColorModifier.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

/**
Expand Down Expand Up @@ -25,4 +41,4 @@ internal enum class ConsoleColorModifier {
FOREGROUND -> "\u001B[${color.code}m"
BACKGROUND -> "\u001B[${color.code + 10}m"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import java.math.BigDecimal
Expand Down Expand Up @@ -25,4 +41,4 @@ fun Byte.toBigInteger(): BigInteger = BigInteger.valueOf(toLong())
*
* @return Returns a [BigDecimal] representation of this [Byte] value.
*/
fun Byte.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toLong())
fun Byte.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toLong())
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import io.onixlabs.kotlin.core.ConsoleColorModifier.BACKGROUND
Expand Down Expand Up @@ -47,4 +63,4 @@ fun println(
value: Any,
foreground: ConsoleColor? = null,
background: ConsoleColor? = null
) = kotlin.io.println("${FOREGROUND.toColor(foreground)}${BACKGROUND.toColor(background)}$value\u001B[0m")
) = kotlin.io.println("${FOREGROUND.toColor(foreground)}${BACKGROUND.toColor(background)}$value\u001B[0m")
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import java.math.BigDecimal
Expand Down Expand Up @@ -32,4 +48,4 @@ fun Double.toBigInteger(): BigInteger = BigInteger.valueOf(toLong())
*
* @return Returns a [BigDecimal] representation of this [Double] value.
*/
fun Double.toBigDecimal(): BigDecimal = BigDecimal.valueOf(this)
fun Double.toBigDecimal(): BigDecimal = BigDecimal.valueOf(this)
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import java.math.BigDecimal
Expand Down Expand Up @@ -32,4 +48,4 @@ fun Float.toBigInteger(): BigInteger = BigInteger.valueOf(toLong())
*
* @return Returns a [BigDecimal] representation of this [Float] value.
*/
fun Float.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toDouble())
fun Float.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toDouble())
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import java.math.BigDecimal
Expand Down Expand Up @@ -25,4 +41,4 @@ fun Int.toBigInteger(): BigInteger = BigInteger.valueOf(toLong())
*
* @return Returns a [BigDecimal] representation of this [Int] value.
*/
fun Int.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toLong())
fun Int.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toLong())
26 changes: 26 additions & 0 deletions src/main/kotlin/io/onixlabs/kotlin/core/Extensions.Kotlin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

/**
* Iterates over the specified collection of elements.
*
* @param T The underlying type of the collection of elements.
* @param items The collection of elements to iterate over.
* @param action The action to perform for each element in the collection.
*/
fun <T> forEach(vararg items: T, action: (T) -> Unit) = items.forEach(action)
44 changes: 44 additions & 0 deletions src/main/kotlin/io/onixlabs/kotlin/core/Extensions.Long.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import java.math.BigDecimal
import java.math.BigInteger

/**
* Gets the constant ZERO of type [Long].
*/
val Long.Companion.ZERO: Long get() = 0L

/**
* Gets the constant ONE of type [Long].
*/
val Long.Companion.ONE: Long get() = 1L

/**
* Converts a [Long] value to a [BigInteger] value.
*
* @return Returns a [BigInteger] representation of this [Long] value.
*/
fun Long.toBigInteger(): BigInteger = BigInteger.valueOf(this)

/**
* Converts a [Long] value to a [BigDecimal] value.
*
* @return Returns a [BigDecimal] representation of this [Long] value.
*/
fun Long.toBigDecimal(): BigDecimal = BigDecimal.valueOf(this)
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

import java.math.BigDecimal
Expand Down Expand Up @@ -25,4 +41,4 @@ fun Short.toBigInteger(): BigInteger = BigInteger.valueOf(toLong())
*
* @return Returns a [BigDecimal] representation of this [Short] value.
*/
fun Short.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toLong())
fun Short.toBigDecimal(): BigDecimal = BigDecimal.valueOf(toLong())
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

/**
Expand Down Expand Up @@ -73,4 +89,4 @@ fun String.toLowerKebabCase(): String = buildString {
) append("-")
append(char.toLowerCase())
}
}
}
18 changes: 17 additions & 1 deletion src/main/kotlin/io/onixlabs/kotlin/core/Internal.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2020 Matthew Layton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.onixlabs.kotlin.core

/**
Expand All @@ -8,4 +24,4 @@ internal const val UNCHECKED_CAST = "UNCHECKED_CAST"
/**
* Provides the constant value for unused member suppression.
*/
internal const val UNUSED = "UNUSED"
internal const val UNUSED = "UNUSED"
Loading

0 comments on commit ae96920

Please sign in to comment.