Skip to content

Commit

Permalink
Add copyright header to all files
Browse files Browse the repository at this point in the history
  • Loading branch information
moallemi committed Mar 24, 2020
1 parent 204ab9f commit e7bcd87
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ repositories {
spotless {
kotlin {
ktlint("0.36.0")
licenseHeaderFile project.rootProject.file('gradle/copyright.kt')
}
}

Expand Down
16 changes: 16 additions & 0 deletions gradle/copyright.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright $YEAR Reza Moallemi
*
* 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.
*/

16 changes: 16 additions & 0 deletions src/main/kotlin/me/moallemi/tools/daterange/date/DateExt.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.date

import java.util.Date
Expand Down
17 changes: 17 additions & 0 deletions src/main/kotlin/me/moallemi/tools/daterange/date/DateIterator.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.date

import java.util.Calendar
Expand All @@ -11,6 +27,7 @@ class DateIterator(
) : Iterator<Date> {

private val calendar = Calendar.getInstance(Locale.getDefault())

private var currentDate = startDate

override fun hasNext() = currentDate <= endDate
Expand Down
19 changes: 17 additions & 2 deletions src/main/kotlin/me/moallemi/tools/daterange/date/DateRange.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.date

import java.util.Date
Expand All @@ -8,8 +24,7 @@ class DateRange(
private val stepDays: Int = 1
) : Iterable<Date>, ClosedRange<Date> {

override fun iterator(): Iterator<Date> =
DateIterator(start, endInclusive, stepDays)
override fun iterator(): Iterator<Date> = DateIterator(start, endInclusive, stepDays)

infix fun step(days: Int) = DateRange(start, endInclusive, days)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.localdate

import java.time.LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.localdate

import java.time.LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.localdate

import java.time.LocalDate
Expand Down
16 changes: 16 additions & 0 deletions src/test/kotlin/me/moallemi/tools/daterange/date/DateRangeTest.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.date

import java.text.SimpleDateFormat
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Reza Moallemi
*
* 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 me.moallemi.tools.daterange.localdate

import java.time.LocalDate
Expand Down

0 comments on commit e7bcd87

Please sign in to comment.