Class DoomVertex

java.lang.Object
net.mtrop.doom.map.data.DoomVertex
All Implemented Interfaces:
BinaryObject

public class DoomVertex extends Object implements BinaryObject
The 4-byte representation of a vertex.
Author:
Matthew Tropiano
  • Field Details

  • Constructor Details

    • DoomVertex

      public DoomVertex()
      Creates a new vertex with default values set.
  • Method Details

    • set

      public void set(int x, int y)
      Sets the coordinates of this vertex.
      Parameters:
      x - the new x-coordinate value.
      y - the new y-coordinate value.
    • getX

      public int getX()
      Returns:
      the X-coordinate value of this vertex.
    • setX

      public void setX(int x)
      Sets the X-coordinate value of this vertex.
      Parameters:
      x - the new x-coordinate value.
      Throws:
      IllegalArgumentException - if x is outside of the range -32768 to 32767.
    • getY

      public int getY()
      Returns:
      the Y-coordinate value of this vertex.
    • setY

      public void setY(int y)
      Sets the Y-coordinate value of this vertex.
      Parameters:
      y - the new y-coordinate value.
      Throws:
      IllegalArgumentException - if y is outside of the range -32768 to 32767.
    • readBytes

      public void readBytes(InputStream in) throws IOException
      Description copied from interface: BinaryObject
      Reads from an InputStream and sets this object's fields. Only reads the amount of bytes that it takes to read a single instance of the object. Note that not every object may have a consistent length!
      Specified by:
      readBytes in interface BinaryObject
      Parameters:
      in - the InputStream to read from.
      Throws:
      IOException - if a read error occurs.
    • writeBytes

      public void writeBytes(OutputStream out) throws IOException
      Description copied from interface: BinaryObject
      Writes this object to an OutputStream.
      Specified by:
      writeBytes in interface BinaryObject
      Parameters:
      out - the OutputStream to write to.
      Throws:
      IOException - if a write error occurs.
    • toString

      public String toString()
      Overrides:
      toString in class Object