com.tenio.engine.ecs.basis.Context Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tenio-engine Show documentation
Show all versions of tenio-engine Show documentation
TenIO is a java NIO (Non-blocking I/O) based server specifically designed for multiplayer games.
It supports UDP and TCP transports which are handled by Netty for high-speed network transmission.
This is the engine module for the game related handlers of the framework.
/*
The MIT License
Copyright (c) 2016-2021 kong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package com.tenio.engine.ecs.basis;
import com.tenio.engine.ecs.basis.implement.ContextInfo;
import java.util.Map;
/**
* A context is used to manage all relative entities and components.
*
* @param the entity template
*/
public interface Context {
/**
* Create new entity.
*
* @return the entity by the corresponding entity template
*/
T createEntity();
/**
* Retrieves an entity by entity id.
*
* @param entityId the entity id
* @return the corresponding entity
*/
T getEntity(String entityId);
/**
* Check if the entity is existed by entity id.
*
* @param entity the entity
* @return true if this entity is existed in the current context, false otherwise
*/
boolean hasEntity(T entity);
/**
* Remove this entity from the current context.
*
* @param entity the corresponding entity
*/
void destroyEntity(T entity);
/**
* Retrieves all entities of the current context.
*
* @return the map of entities
*/
Map getEntities();
/**
* Retrieves the context information.
*
* @return see {@link ContextInfo}
*/
ContextInfo getContextInfo();
/**
* Retrieves the number of entities.
*
* @return the entities count
*/
int getEntitiesCount();
/**
* Remove all context's entities.
*/
void destroyAllEntities();
/**
* Reset the current context.
*/
void reset();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy