Esempio n. 1
0
 public UxlMethod(SourceValue sig, SourceValue?cond, bool isDefault, List <UxlElement> elements = null)
     : base(elements)
 {
     Signature = sig;
     Condition = cond;
     IsDefault = isDefault;
 }
Esempio n. 2
0
        public void SetValue(double value, SourceValue sourceValue = SourceValue.Digits, TimeResult timeValueResult = TimeResult.None, TimeResult timeShortestVariant = TimeResult.None)
        {
            string strFormat = string.Empty;

            if (timeShortestVariant > TimeResult.None && timeShortestVariant < timeValueResult)
            {
                var ts = new TimeShort(value, this.timeResultStrings, sourceValue);
                strFormat = ts.GetShortestString(timeShortestVariant);
            }
            else
            {
                strFormat = this.GetFormatTimeString(this.timeResultStrings, timeValueResult);
            }

            switch (sourceValue)
            {
            case SourceValue.Seconds:
                this.SetText(new TimeFormatFromSeconds()
                {
                    format = strFormat
                }.GetValue(value));
                return;

            case SourceValue.Milliseconds:
                this.SetText(new TimeFormatFromMilliseconds()
                {
                    format = strFormat
                }.GetValue(value));
                return;
            }
        }
Esempio n. 3
0
 public UxlDeclare(Source src, UxlDeclareType type, SourceValue key, SourceValue?cond)
 {
     Source    = src;
     Type      = type;
     Key       = key;
     Condition = cond;
 }
Esempio n. 4
0
 public UxlType(SourceValue name, SourceValue?cond, bool isDefault, List <UxlElement> elements = null)
     : base(elements)
 {
     Name      = name;
     Condition = cond;
     IsDefault = isDefault;
 }
Esempio n. 5
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0) ^
            (StopReason != null ? StopReason.GetHashCode() : 0) ^
            Refills.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            Quantity.GetHashCode() ^
            DaysSupply.GetHashCode() ^
            RouteConceptId.GetHashCode() ^
            EffectiveDrugDose.GetHashCode() ^
            DoseUnitConceptId.GetHashCode() ^
            SourceConceptId.GetHashCode() ^
            (Sig != null ? Sig.GetHashCode() : 0) ^
            (LotNumber != null ? LotNumber.GetHashCode() : 0) ^
            (RouteSourceValue != null ? RouteSourceValue.GetHashCode() : 0) ^
            (DoseUnitSourceValue != null ? DoseUnitSourceValue.GetHashCode() : 0) ^
            ProviderId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()) ^
            (VerbatimEndDate.GetHashCode()) ^
            (StartTime != null ? StartTime.GetHashCode() : 0) ^
            (EndTime != null ? EndTime.GetHashCode() : 0));
 }
Esempio n. 6
0
 public AstExternScope(Source src, IReadOnlyList <AstAttribute> attributes, IReadOnlyList <AstArgument> optionalArgs, SourceValue body)
     : base(src)
 {
     Attributes        = attributes;
     OptionalArguments = optionalArgs;
     Body = body;
 }
Esempio n. 7
0
 public ImageFile(SourceValue sourceName, SourceValue?cond, SourceValue?targetName, int?targetWidth, int?targetHeight)
 {
     SourceName   = sourceName;
     Condition    = cond;
     TargetName   = targetName;
     TargetWidth  = targetWidth;
     TargetHeight = targetHeight;
 }
Esempio n. 8
0
 public AstExtern(Source src, IReadOnlyList <AstAttribute> attributes, AstExpression optionalType, IReadOnlyList <AstArgument> optionalArgs, SourceValue value)
     : base(src)
 {
     Attributes        = attributes;
     OptionalType      = optionalType;
     OptionalArguments = optionalArgs;
     Value             = value;
 }
Esempio n. 9
0
 public UxlElement(UxlElementType type, SourceValue key, SourceValue value, SourceValue?cond, bool isDefault)
 {
     Type      = type;
     Key       = key;
     Value     = value;
     Condition = cond;
     IsDefault = isDefault;
 }
Esempio n. 10
0
 /// <inheritdoc/>
 protected override int CalculateSize()
 {
     if (SourceValue != null)
     {
         return(SourceValue.Sum(t => _FieldCodec.CalculateSizeWithTag(t)));
     }
     return(0);
 }
Esempio n. 11
0
 public UxlImplementation(Source src, ImplementationType type, SourceValue body, SourceValue?cond, bool isDefault)
 {
     Source    = src;
     Type      = type;
     Body      = body;
     Condition = cond;
     IsDefault = isDefault;
 }
Esempio n. 12
0
        public void SetsProperties()
        {
            var propInfo = typeof(SomeClass).GetProperties().First();

            var testee = new SourceValue <SomeClass>(propInfo);

            Assert.AreEqual("A", testee.PropertyName);
            Assert.AreEqual(typeof(string), testee.ValueType);
        }
Esempio n. 13
0
        public void SetsProperties()
        {
            var propInfo = typeof (SomeClass).GetProperties().First();

            var testee = new SourceValue<SomeClass>(propInfo);

            Assert.AreEqual("A", testee.PropertyName);
            Assert.AreEqual(typeof(string), testee.ValueType);
        }
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0));
     //^ ReleventConditionConceptId.GetHashCode();
 }
Esempio n. 15
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Member != null ? Member.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SourceValue != null ? SourceValue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Values != null ? Values.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 16
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            //(EndDate.GetHashCode()) ^
            TypeConceptId.GetHashCode() ^
            //SourceConceptId.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0));
 }
Esempio n. 17
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() ^
            PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0) ^
            (CareSiteId.GetHashCode()) ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()));
 }
Esempio n. 18
0
        public override string GetKey()
        {
            var source = SourceValue;

            if (!string.IsNullOrEmpty(SourceValue))
            {
                source = SourceValue.TrimStart('0');
            }

            return((source ?? "") + ";" + (ProviderSourceValue ?? ""));
        }
Esempio n. 19
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (TypeMap != null ? TypeMap.GetHashCode() : 0);
         result = (result * 397) ^ (SourceType != null ? SourceType.GetHashCode() : 0);
         result = (result * 397) ^ (DestinationType != null ? DestinationType.GetHashCode() : 0);
         result = (result * 397) ^ (SourceValue != null ? SourceValue.GetHashCode() : 0);
         return(result);
     }
 }
Esempio n. 20
0
        public static string GetFullPath(this SourceValue filename)
        {
            if (!filename.String.IsValidPath())
            {
                return(filename.String);
            }

            return(filename.Source.IsUnknown
                ? Path.GetFullPath(filename.String)
                : filename.String.ToFullPath(Path.GetDirectoryName(filename.Source.FullPath)));
        }
Esempio n. 21
0
        public void CreatesGetterExpression()
        {
            var propInfo = typeof(SomeClass).GetProperties().First();

            var testee = new SourceValue<SomeClass>(propInfo);

            var expr = testee.CreateGetter() as Expression<Func<SomeClass, string>>;

            var sourceInstance = new SomeClass {A = "test"};

            Assert.AreEqual("test", expr.Compile()(sourceInstance));
        }
Esempio n. 22
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            ProviderId.GetHashCode() ^
            Quantity.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0) ^
            SourceConceptId.GetHashCode() ^
            (UniqueDeviceId != null ? UniqueDeviceId.GetHashCode() : 0) ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()));
 }
Esempio n. 23
0
        bool CompileBool(SourceValue sourceValue)
        {
            bool result;

            if (!string.IsNullOrEmpty(sourceValue.String) &&
                Preprocessor.TryParseCondition(sourceValue.String, out result))
            {
                return(result);
            }

            Log.Error(sourceValue.Source, ErrorCode.E0000, sourceValue.String.Quote() + " could not be evaluated to 'bool'");
            return(false);
        }
Esempio n. 24
0
        public void SetValue(double value, SourceValue sourceValue = SourceValue.Digits, TimeResult timeValueResult = TimeResult.None, TimeResult timeShortestVariant = TimeResult.None)
        {
            var currentData = new ValueData()
            {
                value               = value,
                sourceValue         = sourceValue,
                timeValueResult     = timeValueResult,
                timeShortestVariant = timeShortestVariant,
                isCreated           = true,
            };

            if (this.lastValueData == currentData)
            {
                return;
            }
            this.lastValueData = currentData;
            this.lastText      = null;

            string strFormat;

            if (timeShortestVariant > TimeResult.None && timeShortestVariant < timeValueResult)
            {
                var ts = new TimeShort(value, this.timeResultStrings, sourceValue);
                strFormat = ts.GetShortestString(timeShortestVariant);
            }
            else
            {
                strFormat = this.GetFormatTimeString(this.timeResultStrings, timeValueResult);
            }

            switch (sourceValue)
            {
            case SourceValue.Digits:
                this.SetText(value.ToString());
                return;

            case SourceValue.Seconds:
                this.SetText(new TimeFormatFromSeconds()
                {
                    format = strFormat
                }.GetValue(value));
                return;

            case SourceValue.Milliseconds:
                this.SetText(new TimeFormatFromMilliseconds()
                {
                    format = strFormat
                }.GetValue(value));
                return;
            }
        }
Esempio n. 25
0
        public void CreatesGetterExpression()
        {
            var propInfo = typeof(SomeClass).GetProperties().First();

            var testee = new SourceValue <SomeClass>(propInfo);

            var expr = testee.CreateGetter() as Expression <Func <SomeClass, string> >;

            var sourceInstance = new SomeClass {
                A = "test"
            };

            Assert.AreEqual("test", expr.Compile()(sourceInstance));
        }
Esempio n. 26
0
        public CopyFile(SourceValue sourceName, CopyFileFlags flags, SourceValue?targetName = null, SourceValue?cond = null, SourceValue?type = null, Func <string, string> preprocess = null)
        {
            Flags      = flags;
            SourceName = sourceName;
            TargetName = targetName;
            Condition  = cond;
            Type       = type;
            Preprocess = preprocess ?? (x => x);

            if (string.IsNullOrEmpty(SourceName.String))
            {
                throw new ArgumentNullException(nameof(sourceName));
            }
        }
Esempio n. 27
0
        private void OutPutUnit_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (outputValueMode == mode.Kin)
            {
                outputValueUnit = (visUnit)OutPutUnit.SelectedIndex;
            }
            else
            {
                outputValueUnit = (visUnit)OutPutUnit.SelectedIndex + 100;
            }
            Calculate();

            SourceValue.Focus();
        }
Esempio n. 28
0
            public TimeShort(double value, TimeResultStrings timeResultStrings, SourceValue sourceValue)
            {
                this.timeResultStrings = timeResultStrings;

                switch (sourceValue)
                {
                case SourceValue.Seconds:
                    this.timeSpan = System.TimeSpan.FromSeconds(value);
                    break;

                case SourceValue.Milliseconds:
                    this.timeSpan = System.TimeSpan.FromMilliseconds(value);
                    break;
                }
            }
Esempio n. 29
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()) ^
            TypeConceptId.GetHashCode() ^
            StatusConceptId.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            (StopReason != null ? StopReason.GetHashCode() : 0) ^
            SourceConceptId.GetHashCode() ^
            ProviderId.GetHashCode() ^
            (StatusSourceValue != null ? StatusSourceValue.GetHashCode() : 0) ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0));
 }
Esempio n. 30
0
        public bool TryGetValue(DataType dt, string propertyName, out SourceValue result, bool escape = false)
        {
            Element       elm;
            TypeExtension typeExt;

            if (Extensions.TypeExtensions.TryGetValue(dt.Prototype, out typeExt) &&
                typeExt.Properties.TryGetValue(propertyName, out elm))
            {
                result = new SourceValue(elm.Source, ExpandSingleLine(elm.Source, elm.String, escape, null, elm.Usings));
                return(true);
            }

            result = default(SourceValue);
            return(false);
        }
 /// <inheritdoc/>
 protected override void Read(ref ParseContext parser)
 {
     if (SourceValue == null)
     {
         SourceValue = new TCollection();
     }
     else
     {
         SourceValue.Clear();
     }
     while (parser.ReadTag() == _Tag)
     {
         SourceValue.Add(_FieldCodec.Read(ref parser));
     }
 }
Esempio n. 32
0
 /// <summary>
 /// Convert a source value to a logic value
 /// </summary>
 public static LogicValue ToLogic(SourceValue Source)
 {
     if (Source == SourceValue.Hi)
     {
         return(LogicValue.Hi);
     }
     if (Source == SourceValue.Low)
     {
         return(LogicValue.Low);
     }
     else
     {
         return(LogicValue.Indeterminate);
     }
 }