Group

io.github.positionpal.group.GroupADT.Group
See theGroup companion object
case class Group[I, O](clients: Map[I, O], name: String) extends GroupOps[I, O]

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait GroupOps[I, O]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def addClient(clientID: I, outputRef: O): Either[ErrorCode[I], GroupOps[I, O]]

Add a new client inside a GroupOps

Add a new client inside a GroupOps

Value parameters

clientID

the reference of the client that joins group

Attributes

Returns

the updated group

Definition Classes
override def clientIDList: List[I]

List of clients IDs that are inside the group

List of clients IDs that are inside the group

Attributes

Returns

A list of clients that are inside the group

Definition Classes
override def executeOnClient[R](id: I)(ex: O => R): Either[ErrorCode[I], R]

Executes a function on a client if it exists in the group

Executes a function on a client if it exists in the group

Type parameters

R

The expected return value type

Value parameters

ex

The function that is executed if the client exists

id

The client identifier

Attributes

Returns

An Either object with an error occurred or the result of the function

Definition Classes
override def executeOnClients(action: O => Unit): Unit

Execute an action on the output reference for a client

Execute an action on the output reference for a client

Value parameters

action

The function that must be executed for each client

Attributes

Definition Classes
override def executeOnCondition[R](id: I)(condition: O => Boolean)(ok: O => R, ko: O => R): Either[ErrorCode[I], R]

Execute an action on a client if it belongs to the group and a specific condition is met

Execute an action on a client if it belongs to the group and a specific condition is met

Type parameters

R

The expected return value type

Value parameters

condition

A function that takes a client as input and return a Boolean

id

The client identifier

ko

The function that is executed if the condition returns false

ok

The function that is executed if the condition returns true

Attributes

Returns

An Either object with an error occurred or the result of the function

Definition Classes
override def getClient(clientID: I): Either[ErrorCode[I], O]

Return a client reference that is currently inside the group

Return a client reference that is currently inside the group

Value parameters

clientID

the id of the client

Attributes

Returns

An Either object indicating an error for the retrieval or the actual reference

Definition Classes
override def isPresent(clientID: I): Boolean

Check if a ClientID is already present inside the group

Check if a ClientID is already present inside the group

Value parameters

clientID

The ClientID to search

Attributes

Definition Classes
override def removeClient(clientID: I): Either[ErrorCode[I], GroupOps[I, O]]

Remove a client inside a GroupOps

Remove a client inside a GroupOps

Value parameters

clientID

the reference of the client to remove

Attributes

Returns

An Either object indicating an error for the deletion or the updated Group

Definition Classes
override def updateClient(clientID: I)(update: O => O): Either[ErrorCode[I], GroupOps[I, O]]

Update a client inside the group

Update a client inside the group

Value parameters

clientID

the id of the client

update

the update function for the

Attributes

Definition Classes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product