Package megamek.common
Class TechAdvancement
java.lang.Object
megamek.common.TechAdvancement
- All Implemented Interfaces:
ITechnology
Handles the progression of technology through prototype, production, extinction and reintroduction phases. Calculates
current rules level for IS or Clan.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from interface megamek.common.interfaces.ITechnology
DATE_ES, DATE_NONE, DATE_PS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intearliestDate(int d1, int d2) Finds the earliest of two dates, ignoring DATE_NA unless both values are set to DATE_NAgetBaseAvailability(Era era) booleanintintgetCommonDate(boolean clan) The common date for either Clan or IS factions.Formats earliest of Clan or IS common date indicating approximate when appropriate for mixed tech.getCommonDateName(boolean clan) Formats common date indicating approximate when appropriate.intIf the tech base is IS or Clan, returns the extinction date that matches the tech base.intgetExtinctionDate(boolean clan) The extinction date for either Clan or IS factions.intgetExtinctionDate(boolean clan, Faction faction) The extinction date for a particular faction.Formats latest of Clan or IS extinction date indicating approximate when appropriate, and extinction faction if any for mixed tech.getExtinctionDateName(boolean clan) Formats extinction date indicating approximate when appropriate, and extinction faction if any for either IS or Clan use tech base.intintgetIntroductionDate(boolean clan) The year the technology first became available for Clan or IS factions, regardless of production level, or APPROXIMATE_MARGIN years earlier if marked as approximate.intgetIntroductionDate(boolean clan, Faction faction) The year the technology first became available for the given faction, regardless of production level, or APPROXIMATE_MARGIN years earlier if marked as approximate.Formats introduction date indicating approximate when appropriate, and prototype faction if any for either IS or Clan use tech base.booleanintintgetProductionDate(boolean clan) The production date for either Clan or IS factions.intgetProductionDate(boolean clan, Faction faction) The production date for a particular faction.Formats earliest of Clan or IS production date indicating approximate when appropriate, and production faction if any for mixed tech.getProductionDateName(boolean clan) Formats production date indicating approximate when appropriate, and production faction if any for either IS or Clan use tech base.intintgetPrototypeDate(boolean clan) The prototype date for either Clan or IS factions.intgetPrototypeDate(boolean clan, Faction faction) The prototype date for a particular faction.Formats earliest of Clan or IS prototype date indicating approximate when appropriate, and prototype faction if any for mixed tech.getPrototypeDateName(boolean clan) Formats prototype date indicating approximate when appropriate, and prototype faction if any for either IS or Clan use tech base.intintgetReintroductionDate(boolean clan) The reintroduction date for either Clan or IS factions.intgetReintroductionDate(boolean clan, Faction faction) The reintroduction date for a particular faction.Formats earliest of Clan or IS reintroduction date indicating approximate when appropriate, and reintroduction faction if any for mixed tech.getReintroductionDateName(boolean clan) Formats reintroduction date indicating approximate when appropriate, and reintroduction faction if any for either IS or Clan use tech base.For non-era-based usage, provide a single tech level that does not vary with date.guessStaticTechLevel(Collection<RulesRef> rulesRefs) booleanisClan()booleansetAdvancement(int... prog) A convenience method that will set identical values for IS and Clan factions.A convenience method that will set identical values for IS and Clan factions.setApproximate(boolean... approx) A convenience method that will set identical values for IS and Clan factions.A convenience method that will set identical values for IS and Clan factions.setApproximate(TechAdvancement.AdvancementPhase... phases) A convenience method that will set identical values for IS and Clan factions.setAvailability(AvailabilityValue sl, AvailabilityValue sw, AvailabilityValue clan, AvailabilityValue da) setAvailability(Era era, AvailabilityValue av) setClanAdvancement(int... prog) Provide years for prototype, production, common, extinction, and reintroduction for Clan factions.Provide years for prototype, production, common, extinction, and reintroduction for Clan factions.setClanAdvancement(TechAdvancement.AdvancementPhase phase, int prog) setClanApproximate(boolean... approx) Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.setClanApproximate(TechAdvancement.AdvancementPhase phase, boolean approximate) setExtinctionFactions(Faction... factions) Sets the factions for which the technology became extinct.setISAdvancement(int... prog) Provide years for prototype, production, common, extinction, and reintroduction for IS factions.Provide years for prototype, production, common, extinction, and reintroduction for IS factions.setISAdvancement(TechAdvancement.AdvancementPhase phase, int prog) setISApproximate(boolean... approx) Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.setISApproximate(TechAdvancement.AdvancementPhase... phases) Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.setISApproximate(TechAdvancement.AdvancementPhase phase, boolean approximate) setProductionFactions(Faction... factions) Sets which factions started production before the technology was commonly available.setPrototypeFactions(Faction... factions) Sets which factions developed a prototype.setReintroductionFactions(Faction... factions) Sets the factions which reintroduced technology that had been extinct.Set RULES LEVELsetTechBase(TechBase base) setTechRating(TechRating rating) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.common.interfaces.ITechnology
calcEraAvailability, calcEraAvailability, calcYearAvailability, calcYearAvailability, calcYearAvailability, findMinimumRulesLevel, findMinimumRulesLevel, getAdvancedRange, getAdvancedRange, getCodeFromIOAbbr, getCodeFromMMAbbr, getEraAvailabilityName, getEraAvailabilityName, getExperimentalRange, getExperimentalRange, getExtinctionRange, getExtinctionRange, getFullRatingName, getFullRatingName, getSimpleLevel, getSimpleLevel, getSimpleLevel, getStandardRange, getStandardRange, getTechLevel, getTechLevel, getTechRatingName, isAvailableIn, isAvailableIn, isAvailableIn, isExtinct, isExtinct, isExtinct, isIntroLevel, isLegal, isLegal, isUnofficial
-
Field Details
-
APPROXIMATE_MARGIN
public static final int APPROXIMATE_MARGIN- See Also:
-
-
Constructor Details
-
TechAdvancement
public TechAdvancement() -
TechAdvancement
-
TechAdvancement
Copy constructor
-
-
Method Details
-
setTechBase
-
getTechBase
- Specified by:
getTechBasein interfaceITechnology
-
setISAdvancement
Provide years for prototype, production, common, extinction, and reintroduction for IS factions.- Parameters:
prog- A map of tech progression years.- Returns:
- a reference to this object
-
setISAdvancement
Provide years for prototype, production, common, extinction, and reintroduction for IS factions.- Parameters:
prog- Up to five tech progression years. Missing levels should be marked by DATE_NONE.- Returns:
- a reference to this object
-
setISAdvancement
-
setClanAdvancement
-
setISApproximate
public TechAdvancement setISApproximate(TechAdvancement.AdvancementPhase phase, boolean approximate) -
setClanApproximate
public TechAdvancement setClanApproximate(TechAdvancement.AdvancementPhase phase, boolean approximate) -
setISApproximate
Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.- Parameters:
approx- A map of tech progression years.- Returns:
- a reference to this object
-
setISApproximate
Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.- Parameters:
approx- Up to five tech progression years.- Returns:
- a reference to this object
-
setISApproximate
Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.- Parameters:
phases- the phases to set as approximate- Returns:
- a reference to this object
-
setClanAdvancement
Provide years for prototype, production, common, extinction, and reintroduction for Clan factions.- Parameters:
prog- A map of tech progression years.- Returns:
- a reference to this object
-
setClanAdvancement
Provide years for prototype, production, common, extinction, and reintroduction for Clan factions.- Parameters:
prog- Up to five tech progression years. Missing levels should be marked by DATE_NONE.- Returns:
- a reference to this object
-
setClanApproximate
Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.- Parameters:
approx- A map of tech progression years.- Returns:
- a reference to this object
-
setClanApproximate
Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.- Parameters:
approx- Up to five tech progression years.- Returns:
- a reference to this object
-
setClanApproximate
Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.- Parameters:
phases- the phases to set as approximate- Returns:
- a reference to this object
-
setAdvancement
A convenience method that will set identical values for IS and Clan factions. Prototype, Production, Common, Extinct, Reintroduced- Parameters:
prog- A map of tech progression years.
-
setAdvancement
A convenience method that will set identical values for IS and Clan factions. Prototype, Production, Common, Extinct, Reintroduced -
getISAdvancement
-
getClanAdvancement
-
getISApproximate
-
getClanApproximate
-
setApproximate
A convenience method that will set identical values for IS and Clan factions.- Parameters:
approx- A map of tech progression years.
-
setApproximate
A convenience method that will set identical values for IS and Clan factions. -
setApproximate
A convenience method that will set identical values for IS and Clan factions.- Parameters:
phases- the phases to set as approximate
-
setPrototypeFactions
Sets which factions developed a prototype.- Parameters:
factions- A list of Faction enums
-
getPrototypeFactions
- Returns:
- A set of Faction enums that indicate which factions started prototype development.
-
setProductionFactions
Sets which factions started production before the technology was commonly available.- Parameters:
factions- A list of Faction enums- Returns:
- A reference to this object.
-
getProductionFactions
- Returns:
- A set of Faction enums that indicate which factions started production before the technology was commonly available.
-
setExtinctionFactions
Sets the factions for which the technology became extinct.- Parameters:
factions- A list of Faction enums- Returns:
- A reference to this object.
-
getExtinctionFactions
- Returns:
- A set of Faction enums that indicate the factions for which the technology became extinct.
-
setReintroductionFactions
Sets the factions which reintroduced technology that had been extinct.- Parameters:
factions- A list of Faction enums- Returns:
- A reference to this object.
-
getReintroductionFactions
- Returns:
- A set of Faction enums that indicate the factions that reintroduced extinct technology. became extinct.
-
getPrototypeDate
public int getPrototypeDate(boolean clan) The prototype date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.- Specified by:
getPrototypeDatein interfaceITechnology
-
getPrototypeDate
The prototype date for a particular faction. If there are prototype factions and the given faction is not among them, the prototype date is DATE_NONE.- Specified by:
getPrototypeDatein interfaceITechnology- Parameters:
clan- Whether to use Clan or IS progression datesfaction- The index of the faction (F_* constant). If < 0, the prototype factions are ignored.
-
getProductionDate
public int getProductionDate(boolean clan) The production date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.- Specified by:
getProductionDatein interfaceITechnology
-
getProductionDate
The production date for a particular faction. If there are production factions and the given faction is not among them, the production date is DATE_NONE.- Specified by:
getProductionDatein interfaceITechnology- Parameters:
clan- Whether to use Clan or IS progression datesfaction- The index of the faction (F_* constant). If < 0, the production factions are ignored.
-
getCommonDate
public int getCommonDate(boolean clan) The common date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.- Specified by:
getCommonDatein interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate(boolean clan) The extinction date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be later by the value of APPROXIMATE_MARGIN.- Specified by:
getExtinctionDatein interfaceITechnology
-
getExtinctionDate
The extinction date for a particular faction. If there are extinction factions and the given faction is not among them, the extinction date is DATE_NONE.- Specified by:
getExtinctionDatein interfaceITechnology- Parameters:
clan- Whether to use Clan or IS progression datesfaction- The index of the faction (F_* constant). If < 0, the extinction factions are ignored.
-
getReintroductionDate
public int getReintroductionDate(boolean clan) The reintroduction date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.- Specified by:
getReintroductionDatein interfaceITechnology
-
getReintroductionDate
The reintroduction date for a particular faction. If there are reintroduction factions and the given faction is not among them, the reintroduction date is DATE_NONE.- Specified by:
getReintroductionDatein interfaceITechnology- Parameters:
clan- Whether to use Clan or IS progression datesfaction- The Faction. If null the reintroduction factions are ignored.
-
getIntroductionDate
public int getIntroductionDate(boolean clan) The year the technology first became available for Clan or IS factions, regardless of production level, or APPROXIMATE_MARGIN years earlier if marked as approximate.- Specified by:
getIntroductionDatein interfaceITechnology
-
getIntroductionDate
The year the technology first became available for the given faction, regardless of production level, or APPROXIMATE_MARGIN years earlier if marked as approximate.- Specified by:
getIntroductionDatein interfaceITechnology
-
getPrototypeDate
public int getPrototypeDate()- Specified by:
getPrototypeDatein interfaceITechnology
-
getProductionDate
public int getProductionDate()- Specified by:
getProductionDatein interfaceITechnology
-
getCommonDate
public int getCommonDate()- Specified by:
getCommonDatein interfaceITechnology
-
getExtinctionDate
public int getExtinctionDate()If the tech base is IS or Clan, returns the extinction date that matches the tech base. Otherwise, returns the latter of the IS and Clan dates, or DATE_NONE if the tech has not gone extinct for both.- Specified by:
getExtinctionDatein interfaceITechnology- Returns:
- Universe-wide extinction date.
-
getReintroductionDate
public int getReintroductionDate()- Specified by:
getReintroductionDatein interfaceITechnology
-
getIntroductionDate
public int getIntroductionDate()- Specified by:
getIntroductionDatein interfaceITechnology
-
getIntroductionDateName
Formats introduction date indicating approximate when appropriate, and prototype faction if any for either IS or Clan use tech base. -
getPrototypeDateName
Formats prototype date indicating approximate when appropriate, and prototype faction if any for either IS or Clan use tech base. -
getPrototypeDateName
Formats earliest of Clan or IS prototype date indicating approximate when appropriate, and prototype faction if any for mixed tech. -
getProductionDateName
Formats production date indicating approximate when appropriate, and production faction if any for either IS or Clan use tech base. -
getProductionDateName
Formats earliest of Clan or IS production date indicating approximate when appropriate, and production faction if any for mixed tech. -
getCommonDateName
Formats common date indicating approximate when appropriate. -
getCommonDateName
Formats earliest of Clan or IS common date indicating approximate when appropriate for mixed tech. -
getExtinctionDateName
Formats extinction date indicating approximate when appropriate, and extinction faction if any for either IS or Clan use tech base. -
getExtinctionDateName
Formats latest of Clan or IS extinction date indicating approximate when appropriate, and extinction faction if any for mixed tech. -
getReintroductionDateName
Formats reintroduction date indicating approximate when appropriate, and reintroduction faction if any for either IS or Clan use tech base. -
getReintroductionDateName
Formats earliest of Clan or IS reintroduction date indicating approximate when appropriate, and reintroduction faction if any for mixed tech. -
earliestDate
public static int earliestDate(int d1, int d2) Finds the earliest of two dates, ignoring DATE_NA unless both values are set to DATE_NA -
getStaticTechLevel
Description copied from interface:ITechnologyFor non-era-based usage, provide a single tech level that does not vary with date.- Specified by:
getStaticTechLevelin interfaceITechnology- Returns:
- The base rules level of the equipment or unit.
-
setStaticTechLevel
Set RULES LEVEL- Parameters:
level- can be any ofSimpleTechLevel- Returns:
- itself
-
guessStaticTechLevel
-
setTechRating
-
getTechRating
- Specified by:
getTechRatingin interfaceITechnology
-
setAvailability
public TechAdvancement setAvailability(AvailabilityValue sl, AvailabilityValue sw, AvailabilityValue clan, AvailabilityValue da) -
setAvailability
-
getBaseAvailability
- Specified by:
getBaseAvailabilityin interfaceITechnology
-
isClan
public boolean isClan()- Specified by:
isClanin interfaceITechnology
-
isMixedTech
public boolean isMixedTech()- Specified by:
isMixedTechin interfaceITechnology
-