Package megamek.common.net.packets
Record Class Packet
java.lang.Object
java.lang.Record
megamek.common.net.packets.Packet
- All Implemented Interfaces:
Serializable
Application layer data packet used to exchange information between client and server.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPacket(PacketCommand command, Object... data) Creates aPacketwith a command and an array of objects -
Method Summary
Modifier and TypeMethodDescriptioncommand()Returns the value of thecommandrecord component.Object[]data()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.getArtilleryAttackAction(int index) getBoardDimensionsSet(int index) getBoardLocationHexMap(int index) getBoardLocationIntegerMap(int index) booleangetBooleanValue(int index) getBuildingList(int index) getCoords(int index) getCoordsHashSet(int index) getCoordsVector(int index) getCoordsWithGroundObjectListMap(int index) getCoordsWithSpecialHexDisplayCollectionMap(int index) getEnemyArtilleryInbound(int index) getEntity(int index) getEntityActionList(int index) getEntityList(int index) getFighterSquadron(int index) getFlareVector(int index) getForce(int index) getForceList(int index) getForces(int index) getGameOptions(int index) getGameTurnList(int index) getHex(int index) getIBasicOptionVector(int index) getInGameObject(int index) getInGameObjectList(int index) getIntegerWithSBFReportEntryList(int index) getIntList(int index) getIntMapToInt(int index) intgetIntValue(int index) getMapSettings(int index) getMinefield(int index) getMinefieldVector(int index) getMovePath(int index) getObject(int index) getPacketCommand(int index) getPlanetaryConditions(int index) getPlayer(int index) getPlayerIDAndListWithBoardLocation(int index) getPlayerVector(int index) getReportList(int index) getReportListOfList(int index) getSBFMovePath(int index) getSBFReportEntryList(int index) getSBFTurnList(int index) getSmokeCloud(int index) getSpecialHexDisplay(int index) getStringValue(int index) getStringWIthBehaviorSettingsMap(int index) getTagInfoVector(int index) getTemporaryECMField(int index) getUnitLocationVector(int index) getWeaponAttackActionList(int index) getWeaponSortOrder(int index) final inthashCode()Returns a hash code value for this object.toString()Returns a string representation of this record class.
-
Constructor Details
-
Packet
Creates aPacketwith a command and an array of objects
-
-
Method Details
-
command
Returns the value of thecommandrecord component.- Returns:
- the value of the
commandrecord component
-
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
getObject
- Parameters:
index- the index of the desired object- Returns:
- the object at the specified index
-
getIntValue
- Parameters:
index- the index of the desired object- Returns:
- the
intvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getIntList
- Parameters:
index- the index of the desired object- Returns:
- a List of
Integer's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getIntMapToInt
- Parameters:
index- the index of the desired object- Returns:
- a Map of
IntegertoInteger's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getIntegerWithSBFReportEntryList
public Map<Integer,List<SBFReportEntry>> getIntegerWithSBFReportEntryList(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Map of
Coordskey's with a Collection ofSpecialHexDisplayvalue's of the object at the specified index - Throws:
InvalidPacketDataException
-
getBooleanValue
- Parameters:
index- the index of the desired object- Returns:
- the
booleanvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getStringValue
- Parameters:
index- the index of the desired object- Returns:
- the
Stringvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getStringWIthBehaviorSettingsMap
public Map<String,BehaviorSettings> getStringWIthBehaviorSettingsMap(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Map of
Stringkey's withBehaviorSettingsvalue's of the object at the specified index - Throws:
InvalidPacketDataException
-
getArtilleryAttackAction
public Vector<ArtilleryAttackAction> getArtilleryAttackAction(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Vector of
ArtilleryAttackAction's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getEnemyArtilleryInbound
- Parameters:
index- the index of the desired object- Returns:
- the
EnemyArtilleryInboundentries at the specified index, or an empty list if the object is absent (e.g. an older packet without this field) or not a list
-
getBoardDimensionsSet
- Parameters:
index- the index of the desired object- Returns:
- a Set of
BoardDimensions's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getBoardLocationHexMap
- Parameters:
index- the index of the desired object- Returns:
- a Map of
BoardLocationkey's withHexvalue's of the object at the specified index - Throws:
InvalidPacketDataException
-
getBuildingList
- Parameters:
index- the index of the desired object- Returns:
- a List of
IBuilding's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getCoords
- Parameters:
index- the index of the desired object- Returns:
- the
Coordsvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getCoordsHashSet
- Parameters:
index- the index of the desired object- Returns:
- a HashSet of
Coords's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getBoardLocationIntegerMap
public HashMap<BoardLocation,Integer> getBoardLocationIntegerMap(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a HashMap of
BoardLocationto Integer at the specified index - Throws:
InvalidPacketDataException
-
getCoordsVector
- Parameters:
index- the index of the desired object- Returns:
- a Vector of
Coords's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getCoordsWithGroundObjectListMap
public Map<Coords,List<ICarryable>> getCoordsWithGroundObjectListMap(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Map of
Coordskey's with a List ofGroundObjectGroundObjectvalue's of the object at the specified index - Throws:
InvalidPacketDataException
-
getCoordsWithSpecialHexDisplayCollectionMap
public Map<Coords,Collection<SpecialHexDisplay>> getCoordsWithSpecialHexDisplayCollectionMap(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Map of
Coordskey's with a Collection ofSpecialHexDisplayvalue's of the object at the specified index - Throws:
InvalidPacketDataException
-
getEntity
- Parameters:
index- the index of the desired object- Returns:
- the
Entityvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getEntityList
- Parameters:
index- the index of the desired object- Returns:
- a List of
Entity's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getEntityActionList
- Parameters:
index- the index of the desired object- Returns:
- a List of
EntityAction's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getFighterSquadron
- Parameters:
index- the index of the desired object- Returns:
- the
FighterSquadronvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getFlareVector
- Parameters:
index- the index of the desired object- Returns:
- a Vector of
Flare's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getForce
- Parameters:
index- the index of the desired object- Returns:
- the
Forcevalue of the object at the specified index or NULL - Throws:
InvalidPacketDataException
-
getForces
- Parameters:
index- the index of the desired object- Returns:
- the
Forcesvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getForceList
- Parameters:
index- the index of the desired object- Returns:
- a List of
Force's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getGameOptions
- Parameters:
index- the index of the desired object- Returns:
- the
GameOptionsvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getGameTurnList
- Parameters:
index- the index of the desired object- Returns:
- a List of
GameTurn's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getHex
- Parameters:
index- the index of the desired object- Returns:
- the
Hexvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getIBasicOptionVector
- Parameters:
index- the index of the desired object- Returns:
- a Vector of
Player's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getInGameObject
- Parameters:
index- the index of the desired object- Returns:
- the
InGameObjectvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getInGameObjectList
- Parameters:
index- the index of the desired object- Returns:
- a List of
InGameObject's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getMapSettings
- Parameters:
index- the index of the desired object- Returns:
- the
MapSettingsvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getMinefield
- Parameters:
index- the index of the desired object- Returns:
- the
Minefieldvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getMinefieldVector
- Parameters:
index- the index of the desired object- Returns:
- a Vector of
Minefield's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getMovePath
- Parameters:
index- the index of the desired object- Returns:
- the
MovePathvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getPacketCommand
- Parameters:
index- the index of the desired object- Returns:
- the
PacketCommandvalue of the object at the specified index
-
getPlanetaryConditions
@Nullable public PlanetaryConditions getPlanetaryConditions(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- the
PlanetaryConditionsvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getPlayer
- Parameters:
index- the index of the desired object- Returns:
- the
Playervalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getPlayerIDAndListWithBoardLocation
public PlayerIDAndList<BoardLocation> getPlayerIDAndListWithBoardLocation(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Vector of
Player's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getPlayerVector
- Parameters:
index- the index of the desired object- Returns:
- a Vector of
Player's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getReportList
- Parameters:
index- the index of the desired object- Returns:
- a List of
Report's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getReportListOfList
- Parameters:
index- the index of the desired object- Returns:
- a List of Lists of
Report's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getSBFMovePath
- Parameters:
index- the index of the desired object- Returns:
- the
SBFMovePathvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getSBFReportEntryList
- Parameters:
index- the index of the desired object- Returns:
- a List of
SBFReportEntry's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getSBFTurnList
- Parameters:
index- the index of the desired object- Returns:
- a List of
SBFTurn's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getSmokeCloud
- Parameters:
index- the index of the desired object- Returns:
- the
SmokeCloudvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getTemporaryECMField
@Nullable public TemporaryECMField getTemporaryECMField(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- the
TemporaryECMFieldvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getSpecialHexDisplay
@Nullable public SpecialHexDisplay getSpecialHexDisplay(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- the
SpecialHexDisplayvalue of the object at the specified index - Throws:
InvalidPacketDataException
-
getTagInfoVector
- Parameters:
index- the index of the desired object- Returns:
- a Vector of
TagInfo's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getUnitLocationVector
@Nullable public Vector<UnitLocation> getUnitLocationVector(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a Vector of
UnitLocation's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getWeaponAttackActionList
public List<WeaponAttackAction> getWeaponAttackActionList(int index) throws InvalidPacketDataException - Parameters:
index- the index of the desired object- Returns:
- a List of
WeaponAttackAction's value of the object at the specified index - Throws:
InvalidPacketDataException
-
getWeaponSortOrder
- Parameters:
index- the index of the desired object- Returns:
- the
WeaponSortOrdervalue of the object at the specified index - Throws:
InvalidPacketDataException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-