Skip to content

Commit

Permalink
Rename Funnel to Spool
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jul 1, 2024
1 parent 48a0c7c commit 8b7ea07
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Binary file removed src/core/.turbulence-core.scala.swp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/core/turbulence.LazyListOutputStream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import vacuous.*

class LazyListOutputStream() extends ji.OutputStream:
private val buffer: scm.ArrayBuffer[Byte] = scm.ArrayBuffer()
private val chunks: Funnel[Bytes] = Funnel()
private val chunks: Spool[Bytes] = Spool()

def stream: LazyList[Bytes] = chunks.stream
def write(int: Int): Unit = buffer.append(int.toByte)
Expand Down
2 changes: 1 addition & 1 deletion src/core/turbulence.Pistol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ package turbulence

import language.adhocExtensions

class Pistol() extends Funnel[Unit]():
class Pistol() extends Spool[Unit]():
def fire(): Unit = put(())
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ package turbulence

import java.util.concurrent as juc

object Funnel:
object Spool:
private object Termination

class Funnel[ItemType]():
private val queue: juc.LinkedBlockingQueue[ItemType | Funnel.Termination.type] =
class Spool[ItemType]():
private val queue: juc.LinkedBlockingQueue[ItemType | Spool.Termination.type] =
juc.LinkedBlockingQueue()

def put(item: ItemType): Unit = queue.put(item)
def stop(): Unit = queue.put(Funnel.Termination)
def stop(): Unit = queue.put(Spool.Termination)

def stream: LazyList[ItemType] =
LazyList.continually(queue.take().nn).takeWhile(_ != Funnel.Termination)
LazyList.continually(queue.take().nn).takeWhile(_ != Spool.Termination)
.asInstanceOf[LazyList[ItemType]]

0 comments on commit 8b7ea07

Please sign in to comment.