Skip to content

KECS / com.juanmedina.kecs.entity / View

View

open class View :MutableCollection<Entity>

A View represent a set of entities in World.

Constructors

Name Summary
<init> Creates a empty View.View()

Properties

Name Summary
entities Entities storage.val entities:ArrayList<Entity>
size Number of entities in our View.open val size:Int

Functions

Name Summary
add Adds a Entity to our view.open fun add(element:Entity):Boolean
addAll Add a set of entities to our view.open fun addAll(elements:Collection<Entity>):Boolean
clear Clear all the entities in our view.open fun clear():Unit
component Return a single component from a single Entity that has a component of the giving type, or throws exception if there is more than one.fun <T :Any> component(): T
components Return the components in our view for a giving class.fun <T :Any> components():List<T>
contains Checks if a Entity exists in our view.open fun contains(element:Entity):Boolean
containsAll Checks if a set of entities exists in our view.open fun containsAll(elements:Collection<Entity>):Boolean
entities Return a set entities that has a component of the giving type.fun <T :Any> entities():List<Entity>
Send to a receiver a set of entities that has a component of the giving type.fun <T :Any> entities(receiver: (Entity) ->Unit):Unit
entity Return a single Entity that has a component of the giving types, or throws exception if there is more than one.fun entity(vararg types:KClass<outAny>):Entity
Return a single Entity that has a component of the giving type, or throws exception if there is more than one.fun <T :Any> entity():Entity
hasComponent Check if we have a any Entity with a given component type.fun <T :Any> hasComponent():Boolean
isEmpty Check if the view has not entities.open fun isEmpty():Boolean
iterator Obtain an Iterator of the entities in our view.open fun iterator():MutableIterator<Entity>
pairs Return a set of Pair from the components of the given type.fun <T :Any, K :Any> pairs():List<Pair<T, K>>
Send a set of Pair from the components of the given type to a receiver.fun <T :Any, K :Any> pairs(receiver: (Pair<T, K>) ->Unit):Unit
remove Removes a specific Entity in our view.open fun remove(element:Entity):Boolean
removeAll Remove a set of entities in our view.open fun removeAll(elements:Collection<Entity>):Boolean
retainAll Remove all entities in a view no matching the ones provided.open fun retainAll(elements:Collection<Entity>):Boolean
toString Generates an String that represent the world.open fun toString():String
triples Return a set of Triple from the components of the given type.fun <T :Any, K :Any, V :Any> triples():List<Triple<T, K, V>>
Send a set of Triple from the components of the given type to a receiver.fun <T :Any, K :Any, V :Any> triples(receiver: (Triple<T, K, V>) ->Unit):Unit
view Create a sub-view giving a set of component classes.fun view(vararg types:KClass<outAny>):View
Send to a receiver a set of Entities for the given typesfun view(vararg types:KClass<outAny>, receiver: (Entity) ->Unit):Unit

Extension Functions

Name Summary
add DSL for adding entities using EntityDsl.funView.add(init:EntityDsl.() ->Unit):Entity

Inheritors

Name Summary
World Contains all the entities and systems on our ECS.class World :View