SIUnit
using Autodesk.DesignScript.Runtime;
using System;
using System.Collections.Generic;
namespace DynamoUnits
{
[IsVisibleInDynamoLibrary(false)]
public abstract class SIUnit : BaseUnit
{
[Obsolete("SIUnit.Value is obsolete")]
public double Value {
get {
return _value;
}
set {
_value = value;
}
}
[IsVisibleInDynamoLibrary(false)]
public abstract double UnitValue { get; }
public static Dictionary<string, double> Conversions => new Dictionary<string, double>();
protected SIUnit(double value)
{
_value = value;
}
[Obsolete("SIUnit.SetValueFromString is obsolete.", false)]
public abstract void SetValueFromString(string value);
[Obsolete("SIUnit.Add is obsolete. Please use + instead.", false)]
public abstract SIUnit Add(SIUnit x);
[Obsolete("SIUnit.Add is obsolete. Please use + instead.", false)]
public abstract SIUnit Add(double x);
[Obsolete("SIUnit.Subtract is obsolete. Please use - instead.", false)]
public abstract SIUnit Subtract(SIUnit x);
[Obsolete("SIUnit.Subtract is obsolete. Please use - instead.", false)]
public abstract SIUnit Subtract(double x);
[Obsolete("SIUnit.Multiply is obsolete. Please use * instead.", false)]
public abstract SIUnit Multiply(SIUnit x);
[Obsolete("SIUnit.Multiply is obsolete. Please use * instead.", false)]
public abstract SIUnit Multiply(double x);
[Obsolete("SIUnit.Divide is obsolete. Please use / instead.", false)]
public abstract dynamic Divide(SIUnit x);
[Obsolete("SIUnit.Divide is obsolete. Please use / instead.", false)]
public abstract SIUnit Divide(double x);
[Obsolete("SIUnit.Modulo is obsolete. Please use % instead.", false)]
public abstract SIUnit Modulo(SIUnit x);
[Obsolete("SIUnit.Modulo is obsolete. Please use % instead.", false)]
public abstract SIUnit Modulo(double x);
[Obsolete("SIUnit.Round is obsolete. Please use Round instead.", false)]
public abstract SIUnit Round();
[Obsolete("SIUnit.Ceiling is obsolete. Please use Ceiling instead.", false)]
public abstract SIUnit Ceiling();
[Obsolete("SIUnit.Floor is obsolete. Please use Floor instead.", false)]
public abstract SIUnit Floor();
public static SIUnit operator +(SIUnit x, SIUnit y)
{
return x.Add(y);
}
public static SIUnit operator +(SIUnit x, double y)
{
return x.Add(y);
}
public static double operator +(double x, SIUnit y)
{
return x + y.Value;
}
public static SIUnit operator -(SIUnit x, SIUnit y)
{
return x.Subtract(y);
}
public static SIUnit operator -(SIUnit x, double y)
{
return x.Subtract(y);
}
public static double operator -(double x, SIUnit y)
{
return x - y.Value;
}
public static SIUnit operator *(SIUnit x, SIUnit y)
{
return x.Multiply(y);
}
public static SIUnit operator *(SIUnit x, double y)
{
return x.Multiply(y);
}
public static SIUnit operator *(double x, SIUnit y)
{
return y.Multiply(x);
}
public static dynamic operator /(SIUnit x, SIUnit y)
{
if (x.GetType() == y.GetType())
return x.Value / y.Value;
return x.Divide(y);
}
public static SIUnit operator /(SIUnit x, double y)
{
return x.Divide(y);
}
public static SIUnit operator %(SIUnit x, SIUnit y)
{
return x.Modulo(y);
}
public static SIUnit operator %(SIUnit x, double y)
{
return x.Modulo(y);
}
public static double operator %(double x, SIUnit y)
{
return x % y.Value;
}
public static bool operator >(double x, SIUnit y)
{
return x > y.Value;
}
public static bool operator >(SIUnit x, double y)
{
return x.Value > y;
}
public static bool operator >(SIUnit x, SIUnit y)
{
if (x.GetType() == y.GetType())
return x.Value > y.Value;
return false;
}
public static bool operator <(double x, SIUnit y)
{
return x < y.Value;
}
public static bool operator <(SIUnit x, double y)
{
return x.Value < y;
}
public static bool operator <(SIUnit x, SIUnit y)
{
if (x.GetType() == y.GetType())
return x.Value < y.Value;
return false;
}
public static bool operator >=(double x, SIUnit y)
{
return x >= y.Value;
}
public static bool operator >=(SIUnit x, double y)
{
return x.Value >= y;
}
public static bool operator >=(SIUnit x, SIUnit y)
{
if (x.GetType() == y.GetType())
return x.Value >= y.Value;
return false;
}
public static bool operator <=(double x, SIUnit y)
{
return x <= y.Value;
}
public static bool operator <=(SIUnit x, double y)
{
return x.Value <= y;
}
public static bool operator <=(SIUnit x, SIUnit y)
{
if (x.GetType() == y.GetType())
return x.Value <= y.Value;
return false;
}
[Obsolete("SIUnit.ToSIUnit is obsolete.", false)]
public static SIUnit ToSIUnit(object value)
{
return value as SIUnit;
}
[Obsolete("SIUnit.ConvertToHostUnits is obsolete. Please use Convert Between Units.", false)]
public abstract double ConvertToHostUnits();
}
}