package spaceObject;

import java.util.Collection;

import javafx.scene.Group;
import javafx.scene.image.ImageView;

public abstract class SpaceObject extends ImageView implements Entity {

	private final Collection<? extends SpaceObject> _collection;
	private final Group _group;

	public SpaceObject(Collection<? extends SpaceObject> collection, Group group) {

		// Initialize variables
		_collection = collection;
		_group = group;

		// Add space object to group
		group.getChildren().add(this);
	}

	public void remove() {

		// Remove space object from array
		_collection.remove(this);
		_group.getChildren().remove(this);
	}

	public Group getGroup() {
		return _group;
	}

	public Collection<? extends SpaceObject> getCollection() {
		return _collection;
	}
}
