Unordered_Bag

com.phasmidsoftware.gryphon.core.Unordered_Bag
See theUnordered_Bag companion object
case class Unordered_Bag[+T](elements: Bag[T]) extends AbstractUnordered[T]

A case class representing an unordered collection of elements in the form of a Set.

Type parameters

T

the type of the elements contained in the set.

Value parameters

elements

a set of elements of type T forming the basis of the adjacency set. This class extends the Unordered trait, providing a concrete implementation for unordered data structures. The Unordered_Set is immutable, meaning that any operation resulting in modification (such as adding a new element) will return a new instance of Unordered_Set without changing the original instance.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Unordered[T]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def contains[U >: T](u: U): Boolean

Checks if the specified element is present in the set.

Checks if the specified element is present in the set.

Type parameters

U

the type of u and a supertype of T.

Value parameters

u

the element to be checked for presence in the set.

Attributes

Returns

true if the element is present in the set, false otherwise.

def unit[U >: T](elements: Seq[U]): Unordered[U]

Creates a new instance of Unordered with the specified sequence of elements.

Creates a new instance of Unordered with the specified sequence of elements.

This method allows creating a new unordered collection by copying the current instance and replacing its underlying element set with a newly created Bag containing the provided sequence of elements.

Type parameters

U

the type of the elements in the provided sequence, which must be a supertype of the current element type T.

Value parameters

elements

the sequence of elements to populate the new unordered collection. These elements will be used to construct a new Bag, which will replace the current one in the copied instance.

Attributes

Returns

a new instance of Unordered[U] containing the specified elements.

Inherited methods

def +[U >: T](u: U): Unordered[U]

Adds the specified element to the unordered collection.

Adds the specified element to the unordered collection.

Type parameters

U

a supertype of T

Value parameters

u

the element to be added to the collection

Attributes

Returns

a new instance of Unordered with the specified element added

Inherited from:
AbstractUnordered
def count(p: T => Boolean): Int

Counts the elements in the collection that satisfy the given predicate.

Counts the elements in the collection that satisfy the given predicate.

This method evaluates each element in the unordered collection using the provided predicate function p. It returns the total number of elements for which the predicate evaluates to true.

Value parameters

p

a predicate function that takes an element of type T and returns a boolean, indicating whether the element satisfies the condition

Attributes

Returns

the number of elements in the collection that satisfy the predicate

Inherited from:
Unordered
def filter(p: T => Boolean): Unordered[T]

Filters the elements of the collection using the provided predicate function.

Filters the elements of the collection using the provided predicate function.

This method returns a new collection that contains only those elements for which the predicate function p evaluates to true.

Value parameters

p

a predicate function that takes an element of type T and returns a boolean, indicating whether the element satisfies the condition or not.

Attributes

Returns

an instance of Unordered[T] containing the elements that satisfy the predicate.

Inherited from:
AbstractUnordered
def find(p: T => Boolean): Option[T]

Finds the first element in the collection that satisfies the given predicate function.

Finds the first element in the collection that satisfies the given predicate function.

This method traverses the unordered collection to identify the first element for which the provided predicate function p evaluates to true. If such an element is found, it is returned wrapped in an Option. If no such element exists, None is returned.

Value parameters

p

a predicate function that takes an element of type T and returns a boolean, indicating whether the element satisfies the condition.

Attributes

Returns

an Option containing the first element that satisfies the predicate, or None if no such element exists in the collection.

Inherited from:
AbstractUnordered
def isEmpty: Boolean

Checks if the unordered collection of elements is empty.

Checks if the unordered collection of elements is empty.

Attributes

Returns

true if the collection contains no elements, false otherwise.

Inherited from:
AbstractUnordered
def iterator: Iterator[T]

Returns an iterator over the elements in the adjacency set. NOTE that the order of the elements in the iterator is unpredictable.

Returns an iterator over the elements in the adjacency set. NOTE that the order of the elements in the iterator is unpredictable.

Attributes

Returns

an Iterator[T] over the elements of type T contained in the set.

Inherited from:
AbstractUnordered
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
def size: Int

Retrieves the number of elements contained in this collection.

Retrieves the number of elements contained in this collection.

Attributes

Returns

the total count of elements as an integer.

Inherited from:
AbstractUnordered