Bound to a game instance, will add a single entity.
5814
function(entity) {
  // Bind to start event right away.
  var boundStart = entity.start.bind(entity);
  this.on('start', boundStart);
  // Bind to preloadComplete, but only once.
  var boundPreloadComplete = entity.preloadComplete.bind(entity);
  this.once('preloadComplete', boundPreloadComplete);
  // Only bind to update after preloadComplete event.
  var boundUpdate = entity.update.bind(entity);
  this.once('preloadComplete', function() {
    this.on('update', boundUpdate);
  }.bind(this));
  entity.on('destroy', function() {
    this.removeListener('start', boundStart);
    this.removeListener('preloadComplete', boundPreloadComplete);
    this.removeListener('update', boundUpdate);
  }.bind(this));
  this.emit('entityAdded', entity);
}
793824
def _add(self, codeobj):
        """"""
        assert isinstance(codeobj, (CodeNamespace, CodeClass,
                                    CodeFunction, CodeVariable))
        self.children.append(codeobj)
613074
function create (entityTypes) {
  return storeManager.create({
    errorInfoCbGet,
    errorInfoCbAdd,
    create: createEntity.bind(null, entityTypes)
  })
}
557666
def create_entity(self):
        """"""
        self._highest_id_seen += 1
        entity = Entity(self._highest_id_seen, self)
        self._entities.append(entity)
        return entity
965948
function addPointToEntity(
  entity,
  tableColumnStyle,
  scale,
  pixelSize,
  color,
  show
) {
  //no image so use point
  if (
    !defined(tableColumnStyle) ||
    !defined(tableColumnStyle.imageUrl) ||
    tableColumnStyle.imageUrl === ""
  ) {
    entity.point = {
      outlineColor: new Color(0, 0, 0, 1),
      outlineWidth: 1,
      pixelSize: pixelSize,
      color: color,
      show: show
    };
  } else {
    entity.billboard = {
      horizontalOrigin: HorizontalOrigin.CENTER,
      verticalOrigin: VerticalOrigin.BOTTOM,
      image: tableColumnStyle.imageUrl,
      scale: scale,
      color: color,
      show: show
    };
  }
}
1361404
def _insert_entity(entity):
    '''
    
    '''
    _validate_entity(entity)

    request = HTTPRequest()
    request.method = 'POST'
    request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
                        _DEFAULT_PREFER_HEADER,
                        _DEFAULT_ACCEPT_HEADER]
    request.body = _get_request_body(_convert_entity_to_json(entity))

    return request
33483
def add_person_entity(self, entity, instances_json):
        
        check_type(instances_json, dict, [entity.plural])
        entity_ids = list(map(str, instances_json.keys()))
        self.persons_plural = entity.plural
        self.entity_ids[self.persons_plural] = entity_ids
        self.entity_counts[self.persons_plural] = len(entity_ids)

        for instance_id, instance_object in instances_json.items():
            check_type(instance_object, dict, [entity.plural, instance_id])
            self.init_variable_values(entity, instance_object, str(instance_id))

        return self.get_ids(entity.plural)
315911
def ndb_put(self, entity):
    """"""
    assert ndb is not None and isinstance(entity, ndb.Model)
    self.ndb_puts.append(entity)
608876
public EntityBuilder addSubEntity(Entity subEntity) {
    	if(subEntity == null) {
    		throw new IllegalArgumentException("subEntity cannot be null.");
    	}
        addStep("_addEntity", new Object[] { subEntity }, true);
        return this;
    }
691149
def register(cls):
    
    if not issubclass(cls, Entity):
        raise ValueError("Class must be a subclass of abilian.core.entities.Entity")

    Commentable.register(cls)
    return cls
256972
def add(self, data):
        """"""
        assert isinstance(data, bytes)
        with self.lock:
            self.buf += data
1084669
def create(self, model_obj):
        """"""
        # Update the value of the counters
        model_obj = self._set_auto_fields(model_obj)

        # Add the entity to the repository
        identifier = model_obj[self.entity_cls.meta_.id_field.field_name]
        with self.conn['lock']:
            self.conn['data'][self.schema_name][identifier] = model_obj

        return model_obj
390210
def register_new(self, entity_class, entity):
        
        EntityState.manage(entity, self)
        EntityState.get_state(entity).status = ENTITY_STATUS.NEW
        self.__entity_set_map[entity_class].add(entity)
853796
def register(cls):
    
    if not issubclass(cls, Entity):
        raise ValueError("Class must be a subclass of abilian.core.entities.Entity")

    SupportAttachment.register(cls)
    return cls
1113668
public EntityBuilder addSubEntities(List<Entity> entities) {
    	if(entities == null) {
    		throw new IllegalArgumentException("entities cannot be null.");
    	}
    	for (Entity entity : entities) {
            addSubEntity(entity);
        }
        return this;
    }
48196
public int addOrUpdate(Entity entity) throws SQLException {
		return null == entity.get(primaryKeyField) ? add(entity) : update(entity);
	}
985883
@Override
	public void put(Object entity) {
		ResourceManager<Transaction> manager = new AppEngineResourceManager(
				datastore, datastore.beginTransaction(), transaction);
		manager.put(entity);
		Log log = new Log(transaction.logs().size() + 1, Log.Operation.PUT, entity);
		log.state(State.UNCOMMITTED);
		transaction.logs().add(log);
		managers.put(keyValue(entity), manager);
		logger.fine("Transaction [" + transaction.id() + "]: Entity [" + entity + "] has been put");
	}