Struct GorgonRange
A type that represents a range between two int values.
Inherited Members
Namespace: Gorgon.Core
Assembly: Gorgon.Core.dll
Syntax
public readonly struct GorgonRange : IGorgonEquatableByRef<GorgonRange>, IEquatable<GorgonRange>, IComparable<GorgonRange>
Remarks
This a means to determine the range between a minimum int value and a maximum int value. Use this object to determine if a value falls within a specific range of values.
Constructors
| Edit this page View SourceGorgonRange(GorgonRange)
Initializes a new instance of the GorgonRange struct.
Declaration
public GorgonRange(GorgonRange minMax)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | minMax | The min max value to copy. |
GorgonRange(int, int)
Initializes a new instance of the GorgonRange struct.
Declaration
public GorgonRange(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
int | min | The minimum value. |
int | max | The maximum value. |
Fields
| Edit this page View SourceEmpty
An empty range value.
Declaration
public static readonly GorgonRange Empty
Field Value
Type | Description |
---|---|
GorgonRange |
Maximum
The maximum value in the range.
Declaration
public readonly int Maximum
Field Value
Type | Description |
---|---|
int |
Minimum
The minimum value in the range.
Declaration
public readonly int Minimum
Field Value
Type | Description |
---|---|
int |
Properties
| Edit this page View SourceIsEmpty
Property to return whether the range is empty or not.
Declaration
[JsonIgnore]
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
Range
Property to return the range between the two values.
Declaration
[JsonIgnore]
public int Range { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceAdd(GorgonRange, GorgonRange)
Function to add two GorgonRange values together.
Declaration
public static GorgonRange Add(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left GorgonRange value to add |
GorgonRange | right | The right GorgonRange value to add. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange representing the total of both ranges. |
Add(in GorgonRange, in GorgonRange, out GorgonRange)
Function to add two GorgonRange values together.
Declaration
public static void Add(in GorgonRange left, in GorgonRange right, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left GorgonRange value to add |
GorgonRange | right | The right GorgonRange value to add. |
GorgonRange | result | A new GorgonRange representing the total of both ranges. |
CompareTo(GorgonRange)
Compares the current object with another object of the same type.
Declaration
public int CompareTo(GorgonRange other)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other. |
Contains(int)
Function to return whether the int value falls within this GorgonRange.
Declaration
public bool Contains(int value)
Parameters
Type | Name | Description |
---|---|---|
int | value | Value to test. |
Returns
Type | Description |
---|---|
bool | true if the value falls into the range, false if not. |
Divide(GorgonRange, int)
Function to divide a GorgonRange by a int value.
Declaration
public static GorgonRange Divide(GorgonRange range, int scalar)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The GorgonRange range value to divide. |
int | scalar | The int scalar value to divide by. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange representing the product of the |
Exceptions
Type | Condition |
---|---|
DivideByZeroException | Thrown if the |
Divide(in GorgonRange, int, out GorgonRange)
Function to divide a GorgonRange by a int value.
Declaration
public static void Divide(in GorgonRange range, int scalar, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The GorgonRange range value to divide. |
int | scalar | The int scalar value to divide by. |
GorgonRange | result | A new GorgonRange representing the product of the |
Exceptions
Type | Condition |
---|---|
DivideByZeroException | Thrown if the |
Equals(GorgonRange)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GorgonRange other)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(in GorgonRange)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(in GorgonRange other)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Another object to compare to. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
| Edit this page View SourceExpand(GorgonRange, int)
Function to expand a GorgonRange by a specific amount.
Declaration
public static GorgonRange Expand(GorgonRange range, int amount)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | A GorgonRange to expand. |
int | amount | The amount to expand the GorgonRange by. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange value, increased in size by |
Expand(in GorgonRange, int, out GorgonRange)
Function to expand a GorgonRange by a specific amount.
Declaration
public static void Expand(in GorgonRange range, int amount, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | A GorgonRange to expand. |
int | amount | The amount to expand the GorgonRange by. |
GorgonRange | result | A new GorgonRange value, increased in size by |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceMultiply(GorgonRange, GorgonRange)
Function to multiply two GorgonRange ranges together.
Declaration
public static GorgonRange Multiply(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left GorgonRange value to multiply. |
GorgonRange | right | The right GorgonRange value to multiply. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange value representing the product of both ranges. |
Multiply(GorgonRange, int)
Function to multiply a GorgonRange by a scalar int value.
Declaration
public static GorgonRange Multiply(GorgonRange range, int scalar)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range to multiply by. |
int | scalar | The int scalar value to multiply. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange representing the product of the |
Multiply(in GorgonRange, in GorgonRange, out GorgonRange)
Function to multiply two GorgonRange ranges together.
Declaration
public static void Multiply(in GorgonRange left, in GorgonRange right, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left GorgonRange value to multiply. |
GorgonRange | right | The right GorgonRange value to multiply. |
GorgonRange | result | A new GorgonRange value representing the product of both ranges. |
Multiply(in GorgonRange, int, out GorgonRange)
Function to multiply a GorgonRange by a scalar int value.
Declaration
public static void Multiply(in GorgonRange range, int scalar, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range to multiply by. |
int | scalar | The int scalar value to multiply. |
GorgonRange | result | A new GorgonRange representing the product of the |
Shrink(GorgonRange, int)
Function to shrink a GorgonRange by a specific amount.
Declaration
public static GorgonRange Shrink(GorgonRange range, int amount)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | A GorgonRange to shrink. |
int | amount | The amount to shrink the GorgonRange by. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange value, decreased in size by |
Shrink(in GorgonRange, int, out GorgonRange)
Function to shrink a GorgonRange by a specific amount.
Declaration
public static void Shrink(in GorgonRange range, int amount, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | A GorgonRange to shrink. |
int | amount | The amount to shrink the GorgonRange by. |
GorgonRange | result | A new GorgonRange value, decreased in size by |
Subtract(GorgonRange, GorgonRange)
Function to subtract two GorgonRange ranges from each other.
Declaration
public static GorgonRange Subtract(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left GorgonRange value to subtract. |
GorgonRange | right | The right GorgonRange value to subtract. |
Returns
Type | Description |
---|---|
GorgonRange | A new GorgonRange value representing the difference of both ranges. |
Subtract(in GorgonRange, in GorgonRange, out GorgonRange)
Function to subtract two GorgonRange ranges from each other.
Declaration
public static void Subtract(in GorgonRange left, in GorgonRange right, out GorgonRange result)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left GorgonRange value to subtract. |
GorgonRange | right | The right GorgonRange value to subtract. |
GorgonRange | result | A new GorgonRange value representing the difference of both ranges. |
ToGorgonRangeD(GorgonRange)
Function to perform an explicit conversion from GorgonRange to GorgonRangeD.
Declaration
public static GorgonRangeD ToGorgonRangeD(GorgonRange range)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range. |
Returns
Type | Description |
---|---|
GorgonRangeD | The result of the conversion. |
ToGorgonRangeF(GorgonRange)
Function to perform an explicit conversion from GorgonRange to GorgonRangeF.
Declaration
public static GorgonRangeF ToGorgonRangeF(GorgonRange range)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range. |
Returns
Type | Description |
---|---|
GorgonRangeF | The result of the conversion. |
ToGorgonRangeM(GorgonRange)
Function to perform an explicit conversion from GorgonRange to GorgonRangeM.
Declaration
public static GorgonRangeM ToGorgonRangeM(GorgonRange range)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range. |
Returns
Type | Description |
---|---|
GorgonRangeM | The result of the conversion. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string containing a fully qualified type name. |
Overrides
Operators
| Edit this page View Sourceoperator +(GorgonRange, GorgonRange)
Implements the operator +.
Declaration
public static GorgonRange operator +(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left range. |
GorgonRange | right | The right range. |
Returns
Type | Description |
---|---|
GorgonRange | The result of the operator. |
operator /(GorgonRange, int)
Implements the operator /.
Declaration
public static GorgonRange operator /(GorgonRange left, int scalar)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left range. |
int | scalar | The right scalar value. |
Returns
Type | Description |
---|---|
GorgonRange | The result of the operator. |
operator ==(GorgonRange, GorgonRange)
Implements the operator ==.
Declaration
public static bool operator ==(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left. |
GorgonRange | right | The right. |
Returns
Type | Description |
---|---|
bool | The result of the operator. |
operator >(GorgonRange, GorgonRange)
Implements the operator >.
Declaration
public static bool operator >(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left instance to compare. |
GorgonRange | right | The right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if left is greater than right. |
operator >=(GorgonRange, GorgonRange)
Implements the operator >=.
Declaration
public static bool operator >=(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left instance to compare. |
GorgonRange | right | The right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if left is greater than right. |
implicit operator GorgonRangeD(GorgonRange)
Performs an explicit conversion from GorgonRange to GorgonRangeD.
Declaration
public static implicit operator GorgonRangeD(GorgonRange range)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range. |
Returns
Type | Description |
---|---|
GorgonRangeD | The result of the conversion. |
implicit operator GorgonRangeF(GorgonRange)
Performs an explicit conversion from GorgonRange to GorgonRangeF.
Declaration
public static implicit operator GorgonRangeF(GorgonRange range)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range. |
Returns
Type | Description |
---|---|
GorgonRangeF | The result of the conversion. |
implicit operator GorgonRangeM(GorgonRange)
Performs an explicit conversion from GorgonRange to GorgonRangeM.
Declaration
public static implicit operator GorgonRangeM(GorgonRange range)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | range | The range. |
Returns
Type | Description |
---|---|
GorgonRangeM | The result of the conversion. |
operator !=(GorgonRange, GorgonRange)
Implements the operator ==.
Declaration
public static bool operator !=(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left. |
GorgonRange | right | The right. |
Returns
Type | Description |
---|---|
bool | The result of the operator. |
operator <(GorgonRange, GorgonRange)
Implements the operator >.
Declaration
public static bool operator <(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left instance to compare. |
GorgonRange | right | The right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if left is greater than right. |
operator <=(GorgonRange, GorgonRange)
Implements the operator >=.
Declaration
public static bool operator <=(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left instance to compare. |
GorgonRange | right | The right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if left is greater than right. |
operator *(GorgonRange, GorgonRange)
Implements the operator *.
Declaration
public static GorgonRange operator *(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left range. |
GorgonRange | right | The right range. |
Returns
Type | Description |
---|---|
GorgonRange | The result of the operator. |
operator *(GorgonRange, int)
Implements the operator *.
Declaration
public static GorgonRange operator *(GorgonRange left, int scalar)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left range. |
int | scalar | The right scalar value. |
Returns
Type | Description |
---|---|
GorgonRange | The result of the operator. |
operator *(int, GorgonRange)
Implements the operator *.
Declaration
public static GorgonRange operator *(int scalar, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
int | scalar | The scalar value. |
GorgonRange | right | The right scalar value. |
Returns
Type | Description |
---|---|
GorgonRange | The result of the operator. |
operator -(GorgonRange, GorgonRange)
Implements the operator -.
Declaration
public static GorgonRange operator -(GorgonRange left, GorgonRange right)
Parameters
Type | Name | Description |
---|---|---|
GorgonRange | left | The left range. |
GorgonRange | right | The right range. |
Returns
Type | Description |
---|---|
GorgonRange | The result of the operator. |