All Downloads are FREE. Search and download functionalities are using the official Maven repository.

enterprises.orbital.impl.evexmlapi.chr.CharacterSheetResponse Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package enterprises.orbital.impl.evexmlapi.chr;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import enterprises.orbital.evexmlapi.chr.ICharacterRole;
import enterprises.orbital.evexmlapi.chr.ICharacterSheet;
import enterprises.orbital.evexmlapi.chr.ICharacterTitle;
import enterprises.orbital.evexmlapi.chr.ISkill;

public class CharacterSheetResponse extends PartialCharacterSheetResponse implements ICharacterSheet {
  private long                          characterID;
  private String                        name;
  private String                        corporationName;
  private long                          corporationID;
  private BigDecimal                    balance;
  private long                          homeStationID;
  private String                        allianceName;
  private long                          allianceID;
  private String                        factionName;
  private long                          factionID;
  private int                           cloneTypeID;
  private String                        cloneName;
  private long                          cloneSkillPoints;
  private long                          freeSkillPoints;
  private final Set  skills = new HashSet();
  private final List  roles  = new ArrayList();
  private final List titles = new ArrayList();

  @Override
  public long getCharacterID() {
    return characterID;
  }

  public void setCharacterID(
                             long characterID) {
    this.characterID = characterID;
  }

  @Override
  public String getName() {
    return name;
  }

  public void setName(
                      String name) {
    this.name = name;
  }

  @Override
  public String getCorporationName() {
    return corporationName;
  }

  public void setCorporationName(
                                 String corporationName) {
    this.corporationName = corporationName;
  }

  @Override
  public long getCorporationID() {
    return corporationID;
  }

  public void setCorporationID(
                               long corporationID) {
    this.corporationID = corporationID;
  }

  @Override
  public BigDecimal getBalance() {
    return balance;
  }

  public void setBalance(
                         BigDecimal balance) {
    this.balance = balance.setScale(2, RoundingMode.HALF_UP);
  }

  public void setHomeStationID(
                               long homeStationID) {
    this.homeStationID = homeStationID;
  }

  public void setAllianceName(
                              String allianceName) {
    if (allianceName.length() == 0)
      this.allianceName = null;
    else
      this.allianceName = allianceName;
  }

  public void setAllianceID(
                            long allianceID) {
    this.allianceID = allianceID;
  }

  public void setFactionName(
                             String factionName) {
    if (factionName.length() == 0)
      this.factionName = null;
    else
      this.factionName = factionName;
  }

  public void setFactionID(
                           long factionID) {
    this.factionID = factionID;
  }

  public void setCloneTypeID(
                             int cloneTypeID) {
    this.cloneTypeID = cloneTypeID;
  }

  public void setFreeSkillPoints(
                                 long freeSkillPoints) {
    this.freeSkillPoints = freeSkillPoints;
  }

  @Override
  public long getHomeStationID() {
    return homeStationID;
  }

  @Override
  public String getFactionName() {
    return factionName;
  }

  @Override
  public long getFactionID() {
    return factionID;
  }

  @Override
  public int getCloneTypeID() {
    return cloneTypeID;
  }

  @Override
  public long getFreeSkillPoints() {
    return freeSkillPoints;
  }

  @Override
  public String getAllianceName() {
    return allianceName;
  }

  @Override
  public long getAllianceID() {
    return allianceID;
  }

  public void setCloneName(
                           String cloneName) {
    this.cloneName = cloneName;
  }

  public void setCloneSkillPoints(
                                  long cloneSkillPoints) {
    this.cloneSkillPoints = cloneSkillPoints;
  }

  @Override
  public String getCloneName() {
    return cloneName;
  }

  @Override
  public long getCloneSkillPoints() {
    return cloneSkillPoints;
  }

  @Override
  public void addCollector(
                           CharacterSheetRowsetDataCollector c) {
    // Copy collector objects based on type
    if (c.type.equals("skills")) {
      for (CharacterSheetRowsetData next : c.stuff) {
        ApiCharacterSkill newSkill = new ApiCharacterSkill();
        newSkill.setTypeID(next.getTypeID());
        newSkill.setLevel(next.getLevel());
        newSkill.setSkillpoints(next.getSkillpoints());
        newSkill.setPublished(next.isPublished());
        skills.add(newSkill);
      }
    } else if (c.type.equals("corporationRoles") || c.type.equals("corporationRolesAtHQ") || c.type.equals("corporationRolesAtBase")
        || c.type.equals("corporationRolesAtOther")) {
      for (CharacterSheetRowsetData next : c.stuff) {
        ApiCharacterRole newRole = new ApiCharacterRole();
        newRole.setRoleCategory(c.type);
        newRole.setRoleID(next.getRoleID());
        newRole.setRoleName(next.getRoleName());
        roles.add(newRole);
      }
    } else if (c.type.equals("corporationTitles")) {
      for (CharacterSheetRowsetData next : c.stuff) {
        ApiCharacterTitle newTitle = new ApiCharacterTitle();
        newTitle.setTitleID(next.getTitleID());
        newTitle.setTitleName(next.getTitleName());
        titles.add(newTitle);
      }
    } else
      super.addCollector(c);
  }

  @Override
  public Set getSkills() {
    Set result = new HashSet();
    result.addAll(skills);
    return result;
  }

  @Override
  public Collection getRoles() {
    Collection result = new ArrayList();
    result.addAll(roles);
    return result;
  }

  @Override
  public Collection getTitles() {
    Collection result = new ArrayList();
    result.addAll(titles);
    return result;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy