scp2: task 1.1
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
object TransactionStatus extends Enumeration {
|
||||
val SUCCESS, PENDING, FAILED = Value
|
||||
}
|
||||
|
||||
class TransactionPool {
|
||||
private val queue = new ConcurrentLinkedQueue[Transaction]()
|
||||
|
||||
// Remove and the transaction from the pool
|
||||
def remove(t: Transaction): Boolean = ???
|
||||
def add(t: Transaction): Boolean = queue.offer(t)
|
||||
|
||||
// Return whether the queue is empty
|
||||
def isEmpty: Boolean = ???
|
||||
def remove(t: Transaction): Boolean = queue.remove(t)
|
||||
|
||||
// Return the size of the pool
|
||||
def size: Integer = ???
|
||||
def isEmpty: Boolean = queue.isEmpty
|
||||
|
||||
// Add new element to the back of the queue
|
||||
def add(t: Transaction): Boolean = ???
|
||||
|
||||
// Return an iterator to allow you to iterate over the queue
|
||||
def iterator: Iterator[Transaction] = ???
|
||||
def size: Integer = queue.size
|
||||
|
||||
def iterator: Iterator[Transaction] = queue.iterator.asScala
|
||||
}
|
||||
|
||||
class Transaction(
|
||||
|
||||
Reference in New Issue
Block a user