-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Kill DigitDecomp.isSigned * Create TLVEndpoint, TLVMidpoint ADT. Also add helper method OutcomePayoutPoint.toTlvPoint
- Loading branch information
1 parent
f3e81d0
commit abc1fdd
Showing
7 changed files
with
127 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
package org.bitcoins.core.util | ||
|
||
case class Indexed[T](element: T, index: Int) | ||
case class Indexed[+T](element: T, index: Int) | ||
|
||
object Indexed { | ||
|
||
def apply[T](vec: Vector[T]): Vector[Indexed[T]] = { | ||
vec.zipWithIndex.map { case (elem, index) => Indexed(elem, index) } | ||
} | ||
|
||
/** Takes in a given vector of T's with their corresponding index | ||
* and returns a Vector[Indexed[T]]. | ||
* | ||
* This is useful in situations where you want to preserve the initial | ||
* index in a set of elements, but have performed subsequent collection operations (like .filter, .filterNot, .collect etc) | ||
*/ | ||
def fromGivenIndex[T](vec: Vector[(T, Int)]): Vector[Indexed[T]] = { | ||
vec.map { case (t, idx) => Indexed(t, idx) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters