Class MemoryLocation

java.lang.Object
uk.ac.manchester.spinnaker.machine.MemoryLocation
All Implemented Interfaces:
Comparable<MemoryLocation>

@Immutable
public final class MemoryLocation
extends Object
implements Comparable<MemoryLocation>
A location in SpiNNaker or BMP memory. Does not say which address space this is in.
Author:
Donal Fellows
  • Field Details

    • NULL

      public static final MemoryLocation NULL
      The zero memory location. Often means "no actual address".
    • address

      public final int address
      The actual location.
  • Constructor Details

    • MemoryLocation

      public MemoryLocation​(int address)
      Parameters:
      address - The actual location.
    • MemoryLocation

      public MemoryLocation​(long address)
      Parameters:
      address - The actual location.
  • Method Details

    • add

      public MemoryLocation add​(int offset)
      Add an offset to this location to get a new memory location.
      Parameters:
      offset - The offset to add.
      Returns:
      The new memory location.
    • diff

      public int diff​(MemoryLocation other)
      Get the difference between this location and another.
      Parameters:
      other - The other location.
      Returns:
      This location's address minus the other location's address.
    • isNull

      public boolean isNull()
      Returns:
      Whether this location is really null.
    • subWordAlignment

      public int subWordAlignment()
      How many bytes is this location's address above a word-aligned address?
      Returns:
      The number of bytes offset.
    • isAligned

      public boolean isAligned()
      Returns:
      Whether this is a word-aligned location.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object other)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo​(MemoryLocation other)
      Specified by:
      compareTo in interface Comparable<MemoryLocation>
    • lessThan

      public boolean lessThan​(MemoryLocation other)
      Test if this location is less than another location.
      Parameters:
      other - The other location.
      Returns:
      True if this location's address comes before.
    • greaterThan

      public boolean greaterThan​(MemoryLocation other)
      Test if this location is greater than another location.
      Parameters:
      other - The other location.
      Returns:
      True if this location's address comes after.
    • toString

      public String toString()
      Overrides:
      toString in class Object