public struct CellLong : IEquatable<CellLong>, IComparable<CellLong>
Represents a 2D or 3D cell. Similar to
Cell but it uses longs to store the indices. Set the layer to 1 if the cell is meant to
be 2D.
This struct is mainly used by editor code and is not really intended to be used by
users, however you can use it if you wish. In most cases,
however, you will need to cast the CellLong to a Cell in order to interact with the
SAM API, so using the CellLong structure just results
in more memory being used without any gain.
Name | Type | Default Value | Description |
---|---|---|---|
One | CellLong |
A CellLong set to row/column/layer = 1. Provided for ease of use. |
|
Zero | CellLong |
A CellLong set to row/column/layer = 0. Provided for ease of use. |
Name | Type | Description |
---|---|---|
Column | long |
Gets the column index of the CellLong. |
Item(System.Int32) | long |
Indexer which Gets the row, column, or layer component of the CellLong by using an
index (0 = row, 1 = columns, 2 = layer).
|
Layer | long |
Gets the layer index of the CellLong. |
Row | long |
Gets the row index of the CellLong. |
public CellLong(long row, long column, long layer)
Initializes a new instance of the CellLong structure.
Name | Type | Description |
---|---|---|
row | long |
The row index of the CellLong. |
column | long |
The column index of the CellLong. |
layer | long |
The layer index of the CellLong. Only needed when the CellLong is associated with a three dimensional entity, otherwise just pass in 1. |
public static CellLong operator *(CellLong left, CellLong right)
* operater implementation that allows you to multiple one CellLong by another.
The row from the second CellLong is multiplied by the row from the first. The column
by the column. The layer by the layer.
Name | Type | Description |
---|---|---|
left | CellLong |
The first CellLong. |
right | CellLong |
The second CellLong. |
CellLong
The CellLong representing the multiplication of the second CellLong by the first
public static CellLong operator +(CellLong left, CellLong right)
+ operater implementation that allows you to add two CellLongs together. Row is added to row, column to column, and layer to layer from each CellLong.
Name | Type | Description |
---|---|---|
left | CellLong |
The first CellLong. |
right | CellLong |
The second CellLong. |
CellLong
The CellLong representing the addition of the two input CellLongs.
public static CellLong operator -(CellLong left, CellLong right)
- operater implementation that allows you to subtract one CellLong from another.
The row from the second CellLong is subtracted from the row of the first. The column
from the column. The layer from the layer.
Name | Type | Description |
---|---|---|
left | CellLong |
The first CellLong. |
right | CellLong |
The second CellLong. |
CellLong
The CellLong representing the subtraction of the second CellLong from the first
public static bool operator !=(CellLong left, CellLong right)
!= operater implementation that allows you check if two CellLongs are not equal
The two CellLongs will not be equal if the rows, columns, or layers do not match each
other from one CellLong to
the other (row != row, etc.)
Name | Type | Description |
---|---|---|
left | CellLong |
The first CellLong. |
right | CellLong |
The second CellLong. |
bool
Returns true if the CellLongs are not equal, false if they are equal.
public static CellLong operator /(CellLong numerator, CellLong denominator)
/ operater implementation that allows you to divide one CellLong by another.
The row from the numerator CellLong is divided by the row from the denominator CellLong
(numerator/denominator). The column by the column. The layer by the layer.
Name | Type | Description |
---|---|---|
numerator | CellLong |
The numerator CellLong. |
denominator | CellLong |
The denominator CellLong. |
CellLong
The CellLong representing the division of the numerator CellLong by the denominator
CellLong. Uses longeger division for each component of the CellLong.
public static bool operator <(CellLong left, CellLong right)
< operater implementation that allows you check if the left CellLong is less than the right CellLong.
Name | Type | Description |
---|---|---|
left | CellLong |
The left CellLong. |
right | CellLong |
The right CellLong. |
bool
Please refer to the CompareTo method documentation to understand
how CellLong comparison works.
public static bool operator <=(CellLong left, CellLong right)
<= operater implementation that allows you check if the left CellLong is less than or equal to the right CellLong.
Name | Type | Description |
---|---|---|
left | CellLong |
The left CellLong. |
right | CellLong |
The right CellLong. |
bool
Please refer to the CompareTo method documentation to understand
how CellLong comparison works.
public static bool operator ==(CellLong left, CellLong right)
!= operater implementation that allows you check if two CellLongs are equal
The two CellLongs will be equal if the rows, columns, or layers all match each other
from one CellLong to
the other (row == row, etc.)
Name | Type | Description |
---|---|---|
left | CellLong |
The first CellLong. |
right | CellLong |
The second CellLong. |
bool
Returns true if the CellLongs are equal, false if they are not equal.
public static bool operator >(CellLong left, CellLong right)
> operater implementation that allows you check if the left CellLong is greater than the right CellLong.
Name | Type | Description |
---|---|---|
left | CellLong |
The left CellLong. |
right | CellLong |
The right CellLong. |
bool
Please refer to the CompareTo method documentation to understand
how CellLong comparison works.
public static bool operator >=(CellLong left, CellLong right)
>= operater implementation that allows you check if the left CellLong is greater than or equal to the right CellLong.
Name | Type | Description |
---|---|---|
left | CellLong |
The left CellLong. |
right | CellLong |
The right CellLong. |
bool
Please refer to the CompareTo method documentation to understand
how CellLong comparison works.
public int CompareTo(CellLong other)
Compares the input CellLong against this CellLong to determine whether this CellLong procedes, follows, or is at the same position of the input CellLong. This can be used to order a collection of CellLongs in the same manner as they would appear in the scene (if they were associated with World CellLongs, that is). The method utilizes the row, column, and layer values. If you know the layer value is not used (such as in a 2D world), you may choose to use a different method rather than this one.
Name | Type | Description |
---|---|---|
other | object |
The other CellLong to compare this CellLong against. |
int
-1 if this CellLong precedes (is less than) the input "other" CellLong, +1 if this
CellLong follows (is greater than)
the input "other" CellLong, and 0 if the CellLongs are at the same position (are equal).
The following logic is used to determine the order. First, the layer of the two CellLongs
is compared. If this CellLong's
layer is less than the input CellLong's layer, -1 is returned. If this CellLong's
layer is greater than the input CellLong's layer,
+1 is returned. If the two have the same layer value, the row is compared in the same
manner. If the rows are the same,
the columns are compared. If the columns are compared, 0 is returned as the two CellLong's
are equal and have the same placement
in the order.
public bool Equals(CellLong other)
Implementation of IEquatable<CellLong>.Equals method. Use this, as it does not box input struct.
Name | Type | Description |
---|---|---|
other | object |
The other CellLong to compare this CellLong against. |
bool
false if the row, column, and/or layer value on
the other CellLong is not equal to this CellLong's row, column, and/or layer value.
public override bool Equals(object obj)
Override of Equals method. You shouldn't need to use this, and you should not use it since it will cause the input CellLong to be boxed.
Name | Type | Description |
---|---|---|
obj | object |
The object to check this CellLong against. |
bool
false if the object is not a CellLong or it is but the row, column, and/or layer value
on
the obj is not equal to this CellLong's row, column, and/or layer value.
public override int GetHashCode()
Returns a hash code for this CellLong. Uses all three indexes (row, column and layer) to compute it.
int
The hash code of the CellLong, calculated using all three fields (row, column, and
layer).
public override string ToString()
Returns a nicely formatted string representation of the CellLong's Indexes.
A string representation of the CellLong's Indexes.
public CellLong WithColumnAdjusted(long layerAdjustment)
Returns a copy of the CellLong structure with all values the same except for the Column. The new column value is equal to old column value + columnAdjustment
Name | Type | Description |
---|---|---|
columnAdjustment | long |
The adjustment to the column (added to current column value) |
CellLong
The copy of this CellLong structure with the new adjusted column value
public CellLong WithLayerAdjusted(long layerAdjustment)
Returns a copy of the CellLong structure with all values the same except for the Layer. The new layer value is equal to old layer value + layerAdjustment
Name | Type | Description |
---|---|---|
layerAdjustment | long |
The adjustment to the layer (added to current layer value) |
CellLong
The copy of this CellLong structure with the new adjusted layer value
public CellLong WithNewColumn(long newColumn)
Returns a copy of the CellLong structure with all values the same except for the Column, which is replaced by the input newColumn value.
Name | Type | Description |
---|---|---|
newColumn | long |
The new column value to use. |
CellLong
The copy of this CellLong structure with the new column value.
public CellLong WithNewLayer(long newLayer)
Returns a copy of the CellLong structure with all values the same except for the Layer, which is replaced by the input newLayer value.
Name | Type | Description |
---|---|---|
newLayer | long |
The new layer value to use. |
CellLong
The copy of this CellLong structure with the new layer value.
public CellLong WithNewRow(long newRow)
Returns a copy of the CellLong structure with all values the same except for the Row, which is replaced by the input newRow value.
Name | Type | Description |
---|---|---|
newRow | long |
The new row value to use. |
CellLong
The copy of this CellLong structure with the new row value.
public CellLong WithRowAdjusted(long rowAdjustment)
Returns a copy of the CellLong structure with all values the same except for the Row. The new row value is equal to old row value + rowAdjustment
Name | Type | Description |
---|---|---|
rowAdjustment | long |
The adjustment to the row (added to current row value) |
CellLong
The copy of this CellLong structure with the new adjusted row value