Exemple #1
0
 public NamedUnit(IUnitSystem unitSystem, String name, Unit physicalUnit, CalculatorEnvironment environment = null /* = null */)
 {
     this.Environment = environment;
     if (physicalUnit != null)
     {
         this.pu = physicalUnit;
     }
     else
     {
         this.pu = MakeBaseUnit(name, unitSystem);
     }
 }
        public Boolean FindNameSpace(String nameSpaceName, out CalculatorEnvironment context)
        {
            // Check this namespace
            if (Name != null && Name.Equals(nameSpaceName, StringComparison.OrdinalIgnoreCase))
            {
                context = this;
                return(true);
            }
            else
            // Check outher context
            if (OuterContext != null)
            {
                return(OuterContext.FindNameSpace(nameSpaceName, out context));
            }

            context = null;
            return(false);
        }
 public CalculatorEnvironment(CalculatorEnvironment outerContext, string name, EnvironmentKind environmentkind)
 {
     this.OuterContext    = outerContext;
     this.Name            = name;
     this.environmentkind = environmentkind;
 }
 public FunctionParseInfo(CalculatorEnvironment staticOuterContext, string NewFunctionName)
 {
     this.FunctionName = NewFunctionName;
     this.Function     = new PhysicalQuantityCommandsFunction(staticOuterContext);
 }
        public NamedUnit(IUnitSystem unitSystem, String name, String unitSymbol, Quantity unitValue, CalculatorEnvironment environment /* = null */)
        {
            this.Environment = environment;
            if (unitValue != null)
            {
                if ((unitSystem == null) && (unitValue.Unit != null))
                {
                    unitSystem = unitValue.Unit.ExponentsSystem;
                }

                if (unitValue.Value != 0 && unitValue.Value != 1)
                {
                    this.pu = MakeScaledUnit(name, unitSymbol, unitSystem, unitValue.Unit, unitValue.Value);
                }
                else
                {
                    this.pu = unitValue.Unit;
                }
            }
            else
            {
                this.pu = MakeBaseUnit(name, unitSymbol, unitSystem);
            }
        }
Exemple #6
0
        public NamedUnit(IUnitSystem unitSystem, String name, Quantity physicalQuantity, CalculatorEnvironment environment /* = null */)
        {
            this.Environment = environment;
            if (physicalQuantity != null)
            {
                if ((unitSystem == null) && (physicalQuantity.Unit != null))
                {
                    unitSystem = physicalQuantity.Unit.ExponentsSystem;
                }

                if (physicalQuantity.Value != 0 && physicalQuantity.Value != 1)
                {
                    this.pu = MakeScaledUnit(name, unitSystem, physicalQuantity.Unit, physicalQuantity.Value);
                }
                else
                {
                    this.pu = physicalQuantity.Unit;
                }
            }
            else
            {
                this.pu = MakeBaseUnit(name, unitSystem);
            }
        }