本文整理了Java中com.artemis.utils.Bag.getData()
方法的一些代码示例,展示了Bag.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bag.getData()
方法的具体详情如下:
包路径:com.artemis.utils.Bag
类名称:Bag
方法名:getData
[英]Returns this bag's underlying array.
Use of this method requires typed instantiation, e.g. Bag(Class)
[中]返回此包的基础数组。
使用此方法需要类型化实例化,例如Bag(类)
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-core
/**
* Sort bag.
* Entities must implement Sortable.
*
* Be aware that bags require a resort when you
* remove entries.
*/
public static void sort(Bag bag) {
if ( !bag.isEmpty() ) {
Arrays.sort(bag.getData(), 0, bag.size());
}
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
/**
* Sort bag.
* Entities must implement Sortable.
*
* Be aware that bags require a resort when you
* remove entries.
*/
public static void sort(Bag bag) {
if ( !bag.isEmpty() ) {
Arrays.sort(bag.getData(), 0, bag.size());
}
}
代码示例来源:origin: junkdog/artemis-odb
/** Fetch unique identity for passed composition. */
int getIdentity(BitVector components) {
Object[] bitsets = compositionBits.getData();
int size = compositionBits.size();
for (int i = NO_COMPONENTS; size > i; i++) { // want to start from 1 so that 0 can mean null
if (components.equals(bitsets[i]))
return i;
}
return -1;
}
代码示例来源:origin: junkdog/artemis-odb
/** Fetch unique identity for passed composition. */
int getIdentity(BitVector components) {
BitVector[] bitsets = compositionBits.getData();
int size = compositionBits.size();
for (int i = NO_COMPONENTS; size > i; i++) { // want to start from 1 so that 0 can mean null
if (components.equals(bitsets[i]))
return i;
}
return -1;
}
代码示例来源:origin: junkdog/artemis-odb
protected void processEntities(Bag<Entity> entities) {
Object[] ids = entities.getData();
for (int i = 0, s = entities.size(); s > i; i++) {
process((Entity)ids[i]);
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/** Fetch unique identity for passed composition. */
int getIdentity(BitVector components) {
BitVector[] bitsets = compositionBits.getData();
int size = compositionBits.size();
for (int i = NO_COMPONENTS; size > i; i++) { // want to start from 1 so that 0 can mean null
if (components.equals(bitsets[i]))
return i;
}
return -1;
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
protected void processEntities(Bag<Entity> entities) {
Object[] ids = entities.getData();
for (int i = 0, s = entities.size(); s > i; i++) {
process((Entity)ids[i]);
}
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
/**
* Dispatch event to registered listeners.
* Events are called on the call stack, avoid deeply nested or circular event calls.
*/
@Override
public void dispatch(Event event) {
if ( event == null ) throw new NullPointerException("Event required.");
final Bag<EventListener> listeners = getListenersForHierarchical(event.getClass());
/** Fetch hierarchical list of listeners. */
Object[] data = listeners.getData();
for (int i = 0, s = listeners.size(); i < s; i++) {
final EventListener listener = (EventListener) data[i];
if (listener != null) {
listener.handle(event);
}
}
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-eventbus
/**
* Dispatch event to registered listeners.
* Events are called on the call stack, avoid deeply nested or circular event calls.
*/
@Override
public void dispatch(Event event) {
if ( event == null ) throw new NullPointerException("Event required.");
final Bag<EventListener> listeners = getListenersForHierarchical(event.getClass());
/** Fetch hierarchical list of listeners. */
Object[] data = listeners.getData();
for (int i = 0, s = listeners.size(); i < s; i++) {
final EventListener listener = (EventListener) data[i];
if (listener != null) {
listener.handle(event);
}
}
}
代码示例来源:origin: junkdog/artemis-odb
/** @inheritDoc */
@Override
protected final void processSystem() {
Bag<Entity> entities = getEntities();
Object[] array = entities.getData();
for (int i = 0, s = entities.size(); s > i; i++) {
process((Entity) array[i]);
}
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/** @inheritDoc */
@Override
protected final void processSystem() {
Bag<Entity> entities = getEntities();
Object[] array = entities.getData();
for (int i = 0, s = entities.size(); s > i; i++) {
process((Entity) array[i]);
}
}
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Faster adding of components into the entity.
* <p>
* Not necessary to use this, but in some cases you might need the extra
* performance.
* </p>
*
* @param component the component to add. Does not support packed or pooled.
* @param type the type of the component
* @return this EntityEdit for chaining
* @see #create(Class)
*/
public EntityEdit add(Component component, ComponentType type) {
if (type.isPooled) {
throw new InvalidComponentException(component.getClass(),
"Use EntityEdit#create(Class<Component>) for adding non-basic component types");
}
ComponentMapper mapper = cm.getMapper(type.getType());
mapper.create(entityId);
mapper.components.getData()[entityId] = component;
return this;
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
@Override
public void process() {
Object[] eventsToDispatch = eventQueue.getData();
int i = 0;
int s = eventQueue.size();
while (i < s) {
for (; i < s; i++) {
Event event = (Event) eventsToDispatch[i];
super.dispatch(event);
}
// we may end up having more events to dispatch at this point
// - some event handlers could dispatch more events
s = eventQueue.size();
}
eventQueue.clear();
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-eventbus
@Override
public void process() {
Object[] eventsToDispatch = eventQueue.getData();
int i = 0;
int s = eventQueue.size();
while (i < s) {
for (; i < s; i++) {
Event event = (Event) eventsToDispatch[i];
super.dispatch(event);
}
// we may end up having more events to dispatch at this point
// - some event handlers could dispatch more events
s = eventQueue.size();
}
eventQueue.clear();
}
代码示例来源:origin: DaanVanYperen/artemis-odb-contrib
private void processProfileSystems(Bag<BaseSystem> systems) {
final Object[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
updateEntityStates();
processProfileSystem(profilers[i], (BaseSystem) systemsData[i]);
}
updateEntityStates();
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-plugin-profiler
private void processProfileSystems(Bag<BaseSystem> systems) {
final Object[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
updateEntityStates();
processProfileSystem(profilers[i], (BaseSystem) systemsData[i]);
}
updateEntityStates();
}
代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-eventbus
@Override
public void process() {
Object[] eventsToDispatch = eventQueue.getData();
int i = 0;
int s = eventQueue.size();
while (i < s) {
for (; i < s; i++) {
Event event = (Event) eventsToDispatch[i];
super.dispatch(event);
pools.free(event);
}
// we may end up having more events to dispatch at this point
// - some event handlers could dispatch more events
s = eventQueue.size();
}
eventQueue.clear();
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Processes all systems in order.
* <p>
* Should guarantee artemis is in a sane state using calls to #updateEntityStates
* before each call to a system, and after the last system has been called, or if no
* systems have been called at all.
*/
@Override
protected void process() {
BaseSystem[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
updateEntityStates();
systemsData[i].process();
}
updateEntityStates();
}
}
代码示例来源:origin: junkdog/artemis-odb
/**
* Processes all systems in order.
*
* Should guarantee artemis is in a sane state using calls to #updateEntityStates
* before each call to a system, and after the last system has been called, or if no
* systems have been called at all.
*/
@Override
protected void process() {
Object[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
updateEntityStates();
((BaseSystem)systemsData[i]).process();
}
updateEntityStates();
}
}
代码示例来源:origin: net.onedaybeard.artemis/artemis-odb
/**
* Processes all systems in order.
* <p>
* Should guarantee artemis is in a sane state using calls to #updateEntityStates
* before each call to a system, and after the last system has been called, or if no
* systems have been called at all.
*/
@Override
protected void process() {
BaseSystem[] systemsData = systems.getData();
for (int i = 0, s = systems.size(); s > i; i++) {
if (disabled.get(i))
continue;
updateEntityStates();
systemsData[i].process();
}
updateEntityStates();
}
}
内容来源于网络,如有侵权,请联系作者删除!