Package megamek.common
Class CompositeTechLevel
java.lang.Object
megamek.common.CompositeTechLevel
- All Implemented Interfaces:
Serializable,ITechnology
- Direct Known Subclasses:
RecordingCompositeTechLevel
Determines tech level dates based on tech progression of components.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface megamek.common.interfaces.ITechnology
DATE_ES, DATE_NONE, DATE_PS -
Constructor Summary
ConstructorsConstructorDescriptionCompositeTechLevel(TechAdvancement initialTA, boolean clan, boolean mixed, int introYear, Faction techFaction) CompositeTechLevel(Entity entity, Faction techFaction) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(ITechnology tech) Adjust the dates for various tech levels to account for the tech advancement of a new component.voidaddComponent(ITechnology tech, String componentName) Adjust the dates for various tech levels to account for the tech advancement of a new component, giving the component a name for reporting purposes.intfirstAvailableYearFrom(int year) Returns the first year at or after the given year in which the unit is actually available: no earlier than its first advancement phase, and not inside an extinction period.Formats a list of DateRange objects as a string for display, including era informationDeprecated, for removal: This API element is subject to removal in a future version.getBaseAvailability(Era era) intReturns the common/standard date ranges, accounting for extinction periodsintDeprecated, for removal: This API element is subject to removal in a future version.intintgetExtinctionDate(boolean clan, Faction faction) intintgetIntroductionDate(boolean clan, Faction faction) intintgetProductionDate(boolean clan, Faction faction) Returns the production/advanced date ranges, accounting for extinction periodsintintgetPrototypeDate(boolean clan, Faction faction) Returns the prototype/experimental date ranges, accounting for extinction periodsintintgetReintroductionDate(boolean clan, Faction faction) Deprecated, for removal: This API element is subject to removal in a future version.For non-era-based usage, provide a single tech level that does not vary with date.intgetTechLevel(int year) booleanisClan()booleanprotected voidrecordComponent(ITechnology tech, String componentName) Called after every component has been folded into this composite.voidsetObsoleteYear(int obsoleteYear) Sets the obsolete year for this unit, adding an extinction range from that year onwards.voidsetObsoleteYears(List<Integer> years) Sets multiple obsolete/reintroduction cycles for this unit based on the Obsolete quirk.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, getCodeFromIOAbbr, getCodeFromMMAbbr, getCommonDate, getEraAvailabilityName, getEraAvailabilityName, getExperimentalRange, getExtinctionDate, getExtinctionRange, getFullRatingName, getFullRatingName, getIntroductionDate, getProductionDate, getPrototypeDate, getReintroductionDate, getSimpleLevel, getSimpleLevel, getSimpleLevel, getStandardRange, getTechLevel, getTechRatingName, isAvailableIn, isAvailableIn, isAvailableIn, isExtinct, isExtinct, isExtinct, isIntroLevel, isLegal, isLegal, isUnofficial
-
Constructor Details
-
CompositeTechLevel
public CompositeTechLevel(TechAdvancement initialTA, boolean clan, boolean mixed, int introYear, Faction techFaction) - Parameters:
initialTA- - the base tech advancement for the composite equipmentclan- - whether the equipment tech base is Clanmixed- - whether the equipment contains a mix of Clan and IS equipmentintroYear- - the year the composite equipment is first available - Prototype production common extinction reintroduction They want to use eras - this unit is prototype - new availability type - TN to find a prototype table -
-
CompositeTechLevel
- Parameters:
entity-Entityto check.
-
-
Method Details
-
getExperimentalRange
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getExperimentalRangein interfaceITechnology- Returns:
- - the experimental tech date range, formatted as a string
-
getAdvancedRange
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getAdvancedRangein interfaceITechnology- Returns:
- - the advanced tech date range, formatted as a string
-
getStandardRange
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getStandardRangein interfaceITechnology- Returns:
- - the standard tech date range, formatted as a string
-
getExtinctionRange
- Specified by:
getExtinctionRangein interfaceITechnology- Returns:
- - the range(s) of dates when the tech is extinct
-
addComponent
Adjust the dates for various tech levels to account for the tech advancement of a new component.- Parameters:
tech- - the advancement for the new component
-
addComponent
Adjust the dates for various tech levels to account for the tech advancement of a new component, giving the component a name for reporting purposes.Most components can name themselves (
EquipmentTypeandEngine), but system components such as the armor, the internal structure or a gyro are passed as bareTechAdvancementobjects that carry no name. Those call sites supply one here so that a tech level report can identify every row.- Parameters:
tech- - the advancement for the new componentcomponentName- - the name to report this component under, ornullto derive the name from the component itself
-
recordComponent
Called after every component has been folded into this composite. Does nothing by default; subclasses may override it to record the components that make up the composite. SeeRecordingCompositeTechLevel.- Parameters:
tech- - the advancement of the component that was just addedcomponentName- - the name supplied for the component, ornullif none was given
-
getTechLevel
public int getTechLevel(int year) - Specified by:
getTechLevelin interfaceITechnology- Parameters:
year- Year to check Tech Level for.- Returns:
- the TechConstants tech level for a particular year
-
setObsoleteYear
public void setObsoleteYear(int obsoleteYear) Sets the obsolete year for this unit, adding an extinction range from that year onwards. This should be called after quirks are loaded if the unit has the Obsolete quirk.- Parameters:
obsoleteYear- - the year when production of this obsolete unit ceased
-
setObsoleteYears
Sets multiple obsolete/reintroduction cycles for this unit based on the Obsolete quirk. The years list should be in pairs: obsoleteYear, reintroYear, obsoleteYear2, reintroYear2, ... An odd number of years means the final obsolete period extends indefinitely.- Parameters:
years- - list of years in order: obsolete, reintro, obsolete, reintro, ...
-
firstAvailableYearFrom
public int firstAvailableYearFrom(int year) Returns the first year at or after the given year in which the unit is actually available: no earlier than its first advancement phase, and not inside an extinction period. When the given year falls inside an extinction period, this is the year the unit returns.- Parameters:
year- The year to check from- Returns:
- The first year at or after
yearin which the unit is available, orITechnology.DATE_NONEwhen the unit has gone extinct by then and is never reintroduced
-
getTechBase
- Specified by:
getTechBasein interfaceITechnology
-
isClan
public boolean isClan()- Specified by:
isClanin interfaceITechnology
-
isMixedTech
public boolean isMixedTech()- Specified by:
isMixedTechin interfaceITechnology
-
getIntroductionDate
public int getIntroductionDate()- Specified by:
getIntroductionDatein interfaceITechnology
-
getEarliestTechDate
public int getEarliestTechDate() -
getPrototypeDateRange
Returns the prototype/experimental date ranges, accounting for extinction periods- Returns:
- List of DateRange objects representing when the unit is in prototype phase
-
getProductionDateRange
Returns the production/advanced date ranges, accounting for extinction periods- Returns:
- List of DateRange objects representing when the unit is in production phase
-
getCommonDateRange
Returns the common/standard date ranges, accounting for extinction periods- Returns:
- List of DateRange objects representing when the unit is in common phase
-
formatDateRanges
Formats a list of DateRange objects as a string for display, including era information- Parameters:
ranges- List of DateRange objects- Returns:
- Formatted string representation with era metadata
-
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()- Specified by:
getExtinctionDatein interfaceITechnology
-
getReintroductionDate
public int getReintroductionDate()- Specified by:
getReintroductionDatein interfaceITechnology
-
getTechRating
- Specified by:
getTechRatingin interfaceITechnology
-
getBaseAvailability
- Specified by:
getBaseAvailabilityin interfaceITechnology
-
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.
-
getIntroductionDate
- Specified by:
getIntroductionDatein interfaceITechnology
-
getPrototypeDate
- Specified by:
getPrototypeDatein interfaceITechnology
-
getProductionDate
- Specified by:
getProductionDatein interfaceITechnology
-
getExtinctionDate
- Specified by:
getExtinctionDatein interfaceITechnology
-
getReintroductionDate
- Specified by:
getReintroductionDatein interfaceITechnology
-