All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teambytes.inflatable.raft.model.Term.scala Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.teambytes.inflatable.raft.model

private[inflatable] final case class Term(termNr: Long) extends AnyVal {
  def prev = this - 1
  def next = this + 1

  def -(n: Long): Term = Term(termNr - n)
  def +(n: Long): Term = Term(termNr + n)

  def >(otherTerm: Term): Boolean = this.termNr > otherTerm.termNr
  def <(otherTerm: Term): Boolean = this.termNr < otherTerm.termNr

  def >=(otherTerm: Term): Boolean = this.termNr >= otherTerm.termNr
  def <=(otherTerm: Term): Boolean = this.termNr <= otherTerm.termNr
}

private[inflatable] object Term {
  val Zero = Term(0)
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy