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 Summary
Fields Modifier and Type Field Description int
address
The actual location.static MemoryLocation
NULL
The zero memory location. -
Constructor Summary
Constructors Constructor Description MemoryLocation(int address)
MemoryLocation(long address)
-
Method Summary
Modifier and Type Method Description MemoryLocation
add(int offset)
Add an offset to this location to get a new memory location.int
compareTo(MemoryLocation other)
int
diff(MemoryLocation other)
Get the difference between this location and another.boolean
equals(Object other)
boolean
greaterThan(MemoryLocation other)
Test if this location is greater than another location.int
hashCode()
boolean
isAligned()
boolean
isNull()
boolean
lessThan(MemoryLocation other)
Test if this location is less than another location.int
subWordAlignment()
How many bytes is this location's address above a word-aligned address?String
toString()
-
Field Details
-
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
Add an offset to this location to get a new memory location.- Parameters:
offset
- The offset to add.- Returns:
- The new memory location.
-
diff
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() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MemoryLocation>
-
lessThan
Test if this location is less than another location.- Parameters:
other
- The other location.- Returns:
- True if this location's address comes before.
-
greaterThan
Test if this location is greater than another location.- Parameters:
other
- The other location.- Returns:
- True if this location's address comes after.
-
toString
-