Skip to content

Commit

Permalink
Merge pull request #1147 from ie3-institute/sp/#1142-operationinterval
Browse files Browse the repository at this point in the history
`OperationInterval` extends `RightOpenInterval`
  • Loading branch information
danielfeismann authored Feb 6, 2025
2 parents ec6307c + 705606e commit 3ae0665
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Rewrote PvModelIT from groovy to scala [#646](https://github.com/ie3-institute/simona/issues/646)
- Fix negative required energy demand for thermalHouse [#1127](https://github.com/ie3-institute/simona/issues/1127)
- Refactored EM messages [#1138](https://github.com/ie3-institute/simona/issues/1138)
- `OperationInterval` should extend `RightOpenInterval` [#1142](https://github.com/ie3-institute/simona/issues/1142)

### Fixed
- Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505)
Expand Down
27 changes: 4 additions & 23 deletions src/main/scala/edu/ie3/util/scala/OperationInterval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,15 @@

package edu.ie3.util.scala

import edu.ie3.util.interval.ClosedInterval
import edu.ie3.util.interval.RightOpenInterval

/** Wrapper class for an operation interval, as the superclass
* [[ClosedInterval]] only accepts [[java.lang.Long]] as type parameter
* [[RightOpenInterval]] only accepts [[java.lang.Long]] as type parameter
*
* @param start
* Start of operation period (included)
* @param end
* End of operation period (included)
*/
final case class OperationInterval(start: java.lang.Long, end: java.lang.Long)
extends ClosedInterval[java.lang.Long](start, end) {

/** Get the first tick, in which the operation starts
*
* @return
* Tick, in which operation starts
*/
def getStart: Long = getLower

/** Get the last tick, in which the operation end
*
* @return
* Tick, in which operation end
*/
def getEnd: Long = getUpper
}

object OperationInterval {
def apply(start: Long, end: Long) = new OperationInterval(start, end)
}
final case class OperationInterval(start: Long, end: Long)
extends RightOpenInterval[java.lang.Long](start, end)

0 comments on commit 3ae0665

Please sign in to comment.