Variant#

class ampl.Variant : Comparer, IComparable, global.SystemIDisposable#

AMPL base type, can store a number or a string.

Public Functions

int CompareTo (object obj)#

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Param obj:

An object to compare with this instance.

Return:

A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj . Greater than zero This instance follows obj in the sort order.

override int Compare (Variant x, Variant y)#
void Dispose ()#
override bool Equals (object other)#

Returns true if two Variants have the same type and value.

override int GetHashCode ()#

Get a hash code for this variant.

override string ToString ()#

Return a string representation of this Variant.

Variant (string s)#
Variant (double d)
Variant (ampl.VariantRef other)

Properties

string Str { get; set; }#

If the variant represents a string, gets the string.

Throws exception otherwise

double Dbl { get; set; }#

If the variant represents a number, gets the number.

Throws exception otherwise

Type Type { get; set; }#

Gets the type of this variant.

VariantRef#

class ampl.VariantRef : Comparer, IComparable, global.SystemIDisposable#

AMPL base type, can store a number or a string.

Public Functions

int CompareTo (object obj)#

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Param obj:

An object to compare with this instance.

Return:

A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj . Greater than zero This instance follows obj in the sort order.

override int Compare (VariantRef x, VariantRef y)#
void Dispose ()#
override bool Equals (object other)#

Returns true if two Variants have the same type and value.

override int GetHashCode ()#

Get a hash code for this variant.

override string ToString ()#

Return a string representation of this Variant.

VariantRef (string s)#
VariantRef (double d)
VariantRef (ampl.Variant other)

Properties

string Str { get; set; }#

If the variant represents a string, gets the string.

Throws exception otherwise

double Dbl { get; set; }#

If the variant represents a number, gets the number.

Throws exception otherwise

Type Type { get; set; }#

Gets the type of this variant.