Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Game.Pworld.Pmapping;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.HashSet;
- import Game.Pworld.Pentities.EntityData;
- import Game.Pworld.Pentitydefinitions.EntityAttribute;
- import Game.Pworld.Pentitydefinitions.GameObjects;
- public class TotalEntityMap{
- GameObjects gObjs = new GameObjects();
- Indexer EntityIndX = new Indexer();
- Indexer SectionIndX = new Indexer();
- /**
- * This holds a HashSet of Entity Tags (Int)
- * Referenced by an EntityAttribute Key.
- *
- * @EntityAttribute
- * Entity Classification
- * @Integer
- * Entity Tag Set
- */
- HashMap<EntityAttribute, HashSet<Integer>>
- EntityAttributeSet = new HashMap<EntityAttribute, HashSet<Integer>>();
- /**
- * This holds an EntityData object
- * Referenced by an Entity Tag (Int) Key.
- *
- * @Integer
- * Entity Tag
- * @EntityData
- * Entity Variables
- */
- HashMap<Integer,EntityData>
- EntityDataMap = new HashMap<Integer,EntityData>();
- /**
- * This holds an Entity Name/Label (String)
- * Referenced by an Entity Tag (Int) Key.
- *
- * @Integer
- * Entity Tag
- * @EntityData
- * Entity Name
- */
- HashMap<Integer,String>
- EntityTagNameMap = new HashMap<Integer,String>();
- /**
- * This holds a HashSet of Entity Tags (Int)
- * Referenced by a Section Tag (Int) Key.
- *
- * @Integer
- * Section Tag
- * @EntityData
- * Entity Tag Set
- */
- HashMap<Integer, HashSet<Integer>>
- SectionEntitySet = new HashMap<Integer, HashSet<Integer>>();
- /**
- * This holds a SectionInfo Object
- * Referenced by a Section Tag (Int) Key.
- *
- * @Integer
- * Section Tag
- * @EntityData
- * SectionInfo Object
- */
- HashMap<Integer, SectionInfo>
- SectionInfoMap = new HashMap<Integer, SectionInfo>();
- public TotalEntityMap(){
- for(int i = 0; i < EntityAttribute.values().length; i++){
- EntityAttributeSet.put(EntityAttribute.values()[i],new HashSet<Integer>());
- }
- }
- /**
- *
- * Adds an Entity to the maps.
- * If the tag exists, generated from {@link #EntityIndX} then it will not store the Entity and return.
- *
- * @param entityData
- */
- public void addEntity(EntityData entityData){
- int tag = EntityIndX.getNextTag();
- if(EntityTagNameMap.containsKey(tag)){
- System.out.println("Tag in use... "+tag+": ");
- System.out.println("In Class: "+ this.getClass().getSimpleName()+": Method addEntity");
- return;
- }
- EntityDataMap.put(tag, entityData);
- EntityTagNameMap.put(tag, entityData.getName());
- for(int i = 0; i < EntityAttribute.values().length; i++){
- if(gObjs.getGameObject(entityData.getName()).getAttributes().containsKey(EntityAttribute.values()[i])){
- EntityAttributeSet.get(EntityAttribute.values()[i]).add(tag);
- }
- }
- }
- /**
- *
- * Adds a Section to the maps.
- * If the tag exists, generated from {@link #SectionIndX} then is will not store the Entity and return.
- * This requires a HashSet of SectionEntities and SectionInfo to be complete on creation.
- * @param SectionEntities
- * @param sectionInfo
- */
- public void addSection(HashSet<Integer> SectionEntities, SectionInfo sectionInfo){
- int tag = EntityIndX.getNextTag();
- if(SectionEntitySet.containsKey(tag)){
- System.out.println("Tag in use... "+tag+": ");
- System.out.println("In Class: "+ this.getClass().getSimpleName()+": Method addSection");
- return;
- }
- SectionEntitySet.put(tag, SectionEntities);
- SectionInfoMap.put(tag, sectionInfo);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement