Esempio n. 1
0
 private static double And(double x, double y)
 {
     return(Math.Min(x, y));
 }
Esempio n. 2
0
 public ConvectionInBulk_Localized(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, int _component, double _rhoA, double _rhoB, double _LFFA, double _LFFB, LevelSetTracker _lsTrk) : base(SpatDim, _bcmap, _component, _rhoA, _rhoB, _LFFA, _LFFB, _lsTrk)
 {
 }
Esempio n. 3
0
 static void Main(string[] args)
 {
     double grade = double.Parse(Console.ReadLine());
     string result = GradeResult(grade);
     Console.WriteLine(result);
 }
 public static TElement MinWidth <TElement>(this TElement element, double request) where TElement : VisualElement
 {
     element.MinimumWidthRequest = request; return(element);
 }
 public static TElement MinSize <TElement>(this TElement element, double sizeRequest) where TElement : VisualElement => element.MinWidth(sizeRequest).MinHeight(sizeRequest);
 public static TView Margins <TView>(this TView view, double left = 0, double top = 0, double right = 0, double bottom = 0) where TView : View
 {
     view.Margin = new Thickness(left, top, right, bottom); return(view);
 }
 public static TLayout Paddings <TLayout>(this TLayout layout, double left = 0, double top = 0, double right = 0, double bottom = 0) where TLayout : Layout
 {
     layout.Padding = new Thickness(left, top, right, bottom); return(layout);
 }
Esempio n. 8
0
 public IInstrucao ObtemInstrucaoPadronizada(EnumTipoInstrucao tipoInstrucao, double valorInstrucao,
     DateTime dataInstrucao,
     int diasInstrucao)
 {
     switch (tipoInstrucao)
     {
         case EnumTipoInstrucao.NaoReceberPrincipalSemJurosdeMora:
         {
             return new InstrucaoPadronizada
             {
                 Codigo = 01,
                 QtdDias = diasInstrucao,
                 Valor = valorInstrucao,
                 TextoInstrucao = "NÃO RECEBER PRINCIPAL, SEM JUROS DE MORA"
             };
         }
         case EnumTipoInstrucao.DevolverSenaoPagoAte15DiasAposVencimento:
         {
             return new InstrucaoPadronizada
             {
                 Codigo = 02,
                 QtdDias = diasInstrucao,
                 Valor = valorInstrucao,
                 TextoInstrucao = "DEVOLVER, SE NÃO PAGO, ATÉ 15 DIAS APÓS O VENCIMENTO"
             };
         }
         case EnumTipoInstrucao.DevolverSenaoPagoAte30DiasAposVencimento:
         {
             return new InstrucaoPadronizada
             {
                 Codigo = 03,
                 QtdDias = diasInstrucao,
                 Valor = valorInstrucao,
                 TextoInstrucao = "DEVOLVER, SE NÃO PAGO, ATÉ 30 DIAS APÓS O VENCIMENTO"
             };
         }
         case EnumTipoInstrucao.NaoProtestar:
         {
             return new InstrucaoPadronizada
             {
                 Codigo = 07,
                 QtdDias = diasInstrucao,
                 Valor = valorInstrucao,
                 TextoInstrucao = "NÃO PROTESTAR"
             };
         }
         case EnumTipoInstrucao.NaoCobrarJurosDeMora:
         {
             return new InstrucaoPadronizada
             {
                 Codigo = 08,
                 QtdDias = diasInstrucao,
                 Valor = valorInstrucao,
                 TextoInstrucao = "NÃO COBRAR JUROS DE MORA"
             };
         }
         case EnumTipoInstrucao.MultaVencimento:
         {
             return new InstrucaoPadronizada
             {
                 Codigo = 16,
                 QtdDias = diasInstrucao,
                 Valor = valorInstrucao,
                 TextoInstrucao = "MULTA"
             };
         }
     }
     throw new Exception(
         String.Format(
             "Não foi possível obter instrução padronizada. Banco: {0} Código Instrução: {1} Qtd Dias/Valor: {2}",
             CodigoBanco, tipoInstrucao.ToString(), valorInstrucao));
 }
Esempio n. 9
0
 public double LineHeight(string fontFamily, double fontSize, FontAttributes fontAttributes)
 {
     var fontMetrics = FontMetrics(fontFamily, fontSize, fontAttributes);
     var fontLineHeight = fontMetrics.Descent - fontMetrics.Ascent;
     return fontLineHeight;
 }
Esempio n. 10
0
        private double ChiSquarePval(double x, int df)
        {
            // x = a computed chi-square value.
            // df = degrees of freedom.
            // output = prob. x value occurred by chance.
            // ACM 299.
            if (x <= 0.0 || df < 1)
            {
                throw new ArgumentException("Bad arg in ChiSquarePval()");
            }
            double a  = 0.0; // 299 variable names
            double y  = 0.0;
            double s  = 0.0;
            double z  = 0.0;
            double ee = 0.0; // change from e
            double c;
            bool   even;     // Is df even?

            a = 0.5 * x;
            if (df % 2 == 0)
            {
                even = true;
            }
            else
            {
                even = false;
            }
            if (df > 1)
            {
                y = Exp(-a);         // ACM update remark (4)
            }
            if (even == true)
            {
                s = y;
            }
            else
            {
                s = 2.0 * Gauss(-Math.Sqrt(x));
            }
            if (df > 2)
            {
                x = 0.5 * (df - 1.0);
                if (even == true)
                {
                    z = 1.0;
                }
                else
                {
                    z = 0.5;
                }
                if (a > 40.0) // ACM remark (5)
                {
                    if (even == true)
                    {
                        ee = 0.0;
                    }
                    else
                    {
                        ee = 0.5723649429247000870717135;
                    }
                    c = Math.Log(a); // log base e
                    while (z <= x)
                    {
                        ee = Math.Log(z) + ee;
                        s  = s + Exp(c * z - a - ee); // ACM update remark (6)
                        z  = z + 1.0;
                    }
                    return(s);
                } // a > 40.0
                else
                {
                    if (even == true)
                    {
                        ee = 1.0;
                    }
                    else
                    {
                        ee = 0.5641895835477562869480795 / Math.Sqrt(a);
                    }
                    c = 0.0;
                    while (z <= x)
                    {
                        ee = ee * (a / z); // ACM update remark (7)
                        c  = c + ee;
                        z  = z + 1.0;
                    }
                    return(c * y + s);
                }
            } // df > 2
            else
            {
                return(s);
            }
        } // ChiSquarePval()
Esempio n. 11
0
 public ICodigoOcorrencia ObtemCodigoOcorrencia(EnumCodigoOcorrenciaRemessa ocorrencia, double valorOcorrencia,
     DateTime dataOcorrencia)
 {
     switch (ocorrencia)
     {
         case EnumCodigoOcorrenciaRemessa.Registro:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 01,
                 Descricao = "Remessa"
             };
         }
         case EnumCodigoOcorrenciaRemessa.Baixa:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 02,
                 Descricao = "Pedido de baixa"
             };
         }
         case EnumCodigoOcorrenciaRemessa.ConcessaoDeAbatimento:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 04,
                 Descricao = "Concessão de abatimento"
             };
         }
         case EnumCodigoOcorrenciaRemessa.CancelamentoDeAbatimento:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 05,
                 Descricao = "Cancelamento de abatimento concedido"
             };
         }
         case EnumCodigoOcorrenciaRemessa.AlteracaoDeVencimento:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 06,
                 Descricao = "Alteração de vencimento"
             };
         }
         case EnumCodigoOcorrenciaRemessa.AlteracaoSeuNumero:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 08,
                 Descricao = "Alteração de seu número"
             };
         }
         case EnumCodigoOcorrenciaRemessa.Protesto:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 09,
                 Descricao = "Pedido de Protesto"
             };
         }
         case EnumCodigoOcorrenciaRemessa.NaoProtestar:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 10,
                 Descricao = "Não Protestar"
             };
         }
         case EnumCodigoOcorrenciaRemessa.NaoCobrarJurosDeMora:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 11,
                 Descricao = "Não Cobrar Juros de Mora"
             };
         }
         case EnumCodigoOcorrenciaRemessa.CobrarJurosdeMora:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 16,
                 Descricao = "Cobrar Juros de Mora"
             };
         }
         case EnumCodigoOcorrenciaRemessa.AlteracaoValorTitulo:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 31,
                 Descricao = "(*) Alteração do Valor do Título"
             };
         }
         case EnumCodigoOcorrenciaRemessa.Negativar:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 90,
                 Descricao = "NEGATIVAR"
             };
         }
         case EnumCodigoOcorrenciaRemessa.BaixaNegativacao:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 91,
                 Descricao = "BAIXA DE NEGATIVAÇÃO"
             };
         }
         case EnumCodigoOcorrenciaRemessa.NaoNegativarAutomaticamente:
         {
             return new CodigoOcorrencia((int) ocorrencia)
             {
                 Codigo = 92,
                 Descricao = "NÃO NEGATIVAR AUTOMATICAMENTE"
             };
         }
     }
     throw new Exception(
         String.Format(
             "Não foi possível obter Código de Comando/Movimento/Ocorrência. Banco: {0} Código: {1}",
             CodigoBanco, ocorrencia.ToString()));
 }
Esempio n. 12
0
        // Sources:
        // https://msdn.microsoft.com/en-us/magazine/mt795190.aspx
        // https://www.khanacademy.org/math/statistics-probability/inference-categorical-data-chi-square-tests/v/chi-square-distribution-introduction
        // https://www.uam.es/personal_pdi/ciencias/anabz/Prest/Trabajos/Critical_Values_of_the_Chi-Squared_Distribution.pdf
        // https://www.youtube.com/watch?v=1Ldl5Zfcm1Y
        // http://www.statisticshowto.com/probability-and-statistics/chi-square/
        // http://www.statisticshowto.com/calculate-chi-square-p-value-excel/
        // http://www.statisticshowto.com/support-or-reject-null-hypothesis/

        public bool IsPassingChiSquaredTest(double[] observedSet, double[] expectedSet, double alfa)
        {
            // degrees of freedom (n-1)
            int df = observedSet.Length - 1;
            // calculate chi for given arrays
            double chi    = ChiFromFreqs(observedSet, expectedSet);
            double pValue = ChiSquarePval(chi, df);

            return(pValue > alfa);
        }
Esempio n. 13
0
        // Processing
        public override void OnProcess(long deltatime)
        {
            // Process things?
            base.ProcessThings = (BuilderPlug.Me.ShowVisualThings != 0);

            // Setup the move multiplier depending on gravity
            Vector3D movemultiplier = new Vector3D(1.0f, 1.0f, 1.0f);

            if (BuilderPlug.Me.UseGravity)
            {
                movemultiplier.z = 0.0f;
            }
            General.Map.VisualCamera.MoveMultiplier = movemultiplier;

            // Apply gravity?
            if (BuilderPlug.Me.UseGravity && (General.Map.VisualCamera.Sector != null))
            {
                // Camera below floor level?
                if (General.Map.VisualCamera.Position.z <= (General.Map.VisualCamera.Sector.FloorHeight + cameraflooroffset + 0.1f))
                {
                    // Stay above floor
                    gravity = new Vector3D(0.0f, 0.0f, 0.0f);
                    General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
                                                                     General.Map.VisualCamera.Position.y,
                                                                     General.Map.VisualCamera.Sector.FloorHeight + cameraflooroffset);
                }
                else
                {
                    // Fall down
                    gravity += new Vector3D(0.0f, 0.0f, (float)(GRAVITY * deltatime));
                    General.Map.VisualCamera.Position += gravity;
                }

                // Camera above ceiling level?
                if (General.Map.VisualCamera.Position.z >= (General.Map.VisualCamera.Sector.CeilHeight - cameraceilingoffset - 0.1f))
                {
                    // Stay below ceiling
                    General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
                                                                     General.Map.VisualCamera.Position.y,
                                                                     General.Map.VisualCamera.Sector.CeilHeight - cameraceilingoffset);
                }
            }
            else
            {
                gravity = new Vector3D(0.0f, 0.0f, 0.0f);
            }

            // Do processing
            base.OnProcess(deltatime);

            // Process visible geometry
            foreach (IVisualEventReceiver g in visiblegeometry)
            {
                g.OnProcess(deltatime);
            }

            // Time to pick a new target?
            if (General.stopwatch.Elapsed.TotalMilliseconds > (lastpicktime + PICK_INTERVAL))
            {
                PickTargetUnlocked();
                lastpicktime = General.stopwatch.Elapsed.TotalMilliseconds;
            }

            // The mouse is always in motion
            MouseEventArgs args = new MouseEventArgs(General.Interface.MouseButtons, 0, 0, 0, 0);

            OnMouseMove(args);
        }
Esempio n. 14
0
 private static double Or(double x, double y)
 {
     return(Math.Max(x, y));
 }
Esempio n. 15
0
        public static string FormatValue(double value, TextValueFormat format)
        {
            var output = string.Empty;

            switch (format)
            {
            case TextValueFormat.None: {
                output = value.ToString();

                break;
            }

            case TextValueFormat.WithSpace: {
                if (value < 0f)
                {
                    output = string.Format("-{0}", (-value).ToString("# ### ### ##0").Trim());
                }
                else
                {
                    output = value.ToString("# ### ### ##0").Trim();
                }

                break;
            }

            case TextValueFormat.WithComma: {
                if (value < 0f)
                {
                    output = string.Format("-{0}", (-value).ToString("#,### ### ##0").Trim(','));
                }
                else
                {
                    output = value.ToString("#,### ### ##0").Trim(',').Trim(' ');
                }

                break;
            }

            case TextValueFormat.DateDMHMS: {
                DateTime date = new DateTime((long)value);
                output = date.ToString("dd MM hh:mm:ss");

                break;
            }

            case TextValueFormat.TimeHMSFromSeconds: {
                var t = TimeSpan.FromSeconds(value);
                output = string.Format("{0:D2}:{1:D2}:{2:D2}", t.Hours, t.Minutes, t.Seconds);

                break;
            }

            case TextValueFormat.TimeMSFromSeconds: {
                var t = TimeSpan.FromSeconds(value);
                output = string.Format("{0:D2}:{1:D2}", t.Minutes, t.Seconds);

                break;
            }

            case TextValueFormat.DateDMHMSFromMilliseconds: {
                DateTime date = new DateTime((long)(value / 1000d));
                output = date.ToString("dd MM hh:mm:ss");

                break;
            }

            case TextValueFormat.TimeHMSmsFromMilliseconds: {
                var t = TimeSpan.FromMilliseconds(value);
                output = string.Format("{0:D2}:{1:D2}:{2:D2}`{3:D2}", t.Hours, t.Minutes, t.Seconds, t.Milliseconds);

                break;
            }

            case TextValueFormat.TimeMSmsFromMilliseconds: {
                var t = TimeSpan.FromMilliseconds(value);
                output = string.Format("{0:D2}:{1:D2}`{2:D2}", t.Minutes, t.Seconds, t.Milliseconds);

                break;
            }

            case TextValueFormat.TimeMSFromMilliseconds: {
                var t = TimeSpan.FromMilliseconds(value);
                output = string.Format("{0:D2}:{1:D2}", t.Minutes, t.Seconds);

                break;
            }

            case TextValueFormat.TimeHMSFromMilliseconds: {
                var t = TimeSpan.FromMilliseconds(value);
                output = string.Format("{0:D2}:{1:D2}:{2:D2}", t.Hours, t.Minutes, t.Seconds);

                break;
            }
            }

            return(output);
        }
Esempio n. 16
0
 public double LineSpace(string fontFamily, double fontSize, FontAttributes fontAttributes)
 {
     var fontMetrics = FontMetrics(fontFamily, fontSize, fontAttributes);
     var fontLeading = Math.Abs(fontMetrics.Bottom - fontMetrics.Descent);
     return fontLeading;
 }
 public static TView Margin <TView>(this TView view, double horizontal, double vertical) where TView : View
 {
     view.Margin = new Thickness(horizontal, vertical); return(view);
 }
Esempio n. 18
0
        protected override List <CustomCell> GetListViewSubItems(BaseEntityObject item)
        {
            var subItems = new List <CustomCell>();
            var author   = GlobalObjects.CasEnvironment.GetCorrector(item);

            DateTime?  approx;
            Lifelength remains = Lifelength.Null, next;
            AtaChapter ata;
            MaintenanceControlProcess maintenanceType;
            DateTime   transferDate;
            DateTime?  lastPerformanceDate = null;
            DateTime?  nextEstimated       = null;
            DateTime?  nextLimit           = null;
            Lifelength firstPerformance    = Lifelength.Null,
                       lastPerformance     = Lifelength.Null,
                       lastPerformanceC    = Lifelength.Null,
                       expiryRemain        = Lifelength.Null,
                       nextEstimatedData   = Lifelength.Null,
                       nextEstimatedDataC  = Lifelength.Null,
                       remainEstimated     = Lifelength.Null,
                       nextLimitData       = Lifelength.Null,
                       nextLimitDataC      = Lifelength.Null,
                       remainLimit         = Lifelength.Null,
                       remainLimitC        = Lifelength.Null,
                       IDD = Lifelength.Null,
                       IDDC = Lifelength.Null,
                       warranty, repeatInterval = Lifelength.Null;
            string partNumber,
                   description,
                   serialNumber,
                   position,
                   mpdString             = "",
                   mpdNumString          = "",
                   lastPerformanceString = "",
                   type        = getGroupName(item),
                   classString = "",
                   kitRequieredString,
                   remarks,
                   hiddenRemarks,
                   workType        = "",
                   zone            = "",
                   access          = "",
                   expiryDate      = "",
                   condition       = "",
                   conditionRepeat = "",
                   ndtString       = "";
            double manHours,
                   cost,
                   costServiceable = 0,
                   costOverhaul    = 0;

            if (item is Component)
            {
                Component componentItem = (Component)item;
                approx = componentItem.NextPerformanceDate;
                next   = componentItem.NextPerformanceSource;

                if (ShowGroup)
                {
                    remains = componentItem.LLPCategories ? componentItem.LLPRemains : componentItem.Remains;
                }
                else
                {
                    var selectedCategory = componentItem.ChangeLLPCategoryRecords.GetLast()?.ToCategory;
                    if (selectedCategory != null)
                    {
                        var llp = componentItem.LLPData.GetItemByCatagory(selectedCategory);
                        remains = llp?.Remain;
                    }
                }


                if (componentItem.LLPCategories)
                {
                    nextEstimated      = componentItem.NextPerformance?.PerformanceDate;
                    nextEstimatedData  = componentItem.NextPerformance?.PerformanceSource;
                    nextEstimatedDataC = componentItem.NextPerformance?.PerformanceSourceC;
                    remainEstimated    = componentItem.NextPerformance?.Remains;

                    nextLimit      = componentItem.NextPerformance?.NextPerformanceDateNew;
                    nextLimitData  = componentItem.NextPerformance?.NextLimit;
                    nextLimitDataC = componentItem.NextPerformance?.NextLimitC;
                    remainLimit    = componentItem.NextPerformance?.RemainLimit;
                    remainLimitC   = componentItem.NextPerformance?.RemainLimitC;

                    IDD  = componentItem.NextPerformance?.IDD;
                    IDDC = componentItem.NextPerformance?.IDDC;
                }


                ata              = componentItem.Model != null ? componentItem.Model.ATAChapter : componentItem.ATAChapter;
                partNumber       = componentItem.PartNumber;
                description      = componentItem.Model != null ? componentItem.Model.Description : componentItem.Description;
                serialNumber     = componentItem.SerialNumber;
                position         = componentItem.TransferRecords.GetLast().Position.ToUpper();
                maintenanceType  = componentItem.MaintenanceControlProcess;
                transferDate     = componentItem.TransferRecords.GetLast().TransferDate;
                firstPerformance = componentItem.LifeLimit;
                warranty         = componentItem.Warranty;
                classString      = componentItem.GoodsClass != null?componentItem.GoodsClass.ToString() : "";

                kitRequieredString = componentItem.Kits.Count + " kits";
                manHours           = componentItem.ManHours;
                cost            = componentItem.Cost;
                costOverhaul    = componentItem.CostOverhaul;
                costServiceable = componentItem.CostServiceable;
                remarks         = componentItem.Remarks;
                hiddenRemarks   = componentItem.HiddenRemarks;
                expiryDate      = " ";
                expiryRemain    = Lifelength.Null;
                condition       = !firstPerformance.IsNullOrZero() ? (componentItem.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";
                conditionRepeat = !componentItem.Threshold.RepeatInterval.IsNullOrZero() ? (componentItem.Threshold.RepeatPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";
            }
            else
            {
                ComponentDirective dd = (ComponentDirective)item;
                if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    firstPerformance = dd.Threshold.FirstPerformanceSinceNew;
                }

                if (dd.LastPerformance != null)
                {
                    lastPerformanceString = SmartCore.Auxiliary.Convert.GetDateFormat(dd.LastPerformance.RecordDate);
                    lastPerformance       = dd.LastPerformance?.OnLifelength;
                    lastPerformanceC      = dd.NextPerformance?.LastDataC;
                    lastPerformanceDate   = dd.LastPerformance?.RecordDate;
                }
                if (dd.Threshold.RepeatInterval != null && !dd.Threshold.RepeatInterval.IsNullOrZero())
                {
                    repeatInterval = dd.Threshold.RepeatInterval;
                }
                //GlobalObjects.CasEnvironment.Calculator.GetNextPerformance(dd, out next, out remains, out approx, out cond);
                //GlobalObjects.CasEnvironment.Calculator.GetNextPerformance(dd);
                approx  = dd.NextPerformanceDate;
                next    = dd.NextPerformanceSource;
                remains = dd.Remains;


                nextEstimated      = dd.NextPerformance?.PerformanceDate;
                nextEstimatedData  = dd.NextPerformance?.PerformanceSource;
                nextEstimatedDataC = dd.NextPerformance?.PerformanceSourceC;
                remainEstimated    = dd.NextPerformance?.Remains;

                nextLimit      = dd.NextPerformance?.NextPerformanceDateNew;
                nextLimitData  = dd.NextPerformance?.NextLimit;
                nextLimitDataC = dd.NextPerformance?.NextLimitC;
                remainLimit    = dd.NextPerformance?.RemainLimit;
                remainLimitC   = dd.NextPerformance?.RemainLimitC;


                IDD  = dd.NextPerformance?.IDD;
                IDDC = dd.NextPerformance?.IDDC;

                ata        = dd.ParentComponent.Model != null ? dd.ParentComponent.Model.ATAChapter : dd.ParentComponent.ATAChapter;
                partNumber = "    " + dd.PartNumber;
                var desc = dd.ParentComponent.Model != null
                                        ? dd.ParentComponent.Model.Description
                                        : dd.ParentComponent.Description;

                description     = "    " + desc;
                serialNumber    = "    " + dd.SerialNumber;
                position        = "    " + dd.ParentComponent.TransferRecords.GetLast().Position.ToUpper();
                transferDate    = dd.ParentComponent.TransferRecords.GetLast().TransferDate;
                maintenanceType = dd.ParentComponent.MaintenanceControlProcess;
                warranty        = dd.Threshold.Warranty;
                classString     = dd.ParentComponent.GoodsClass != null?dd.ParentComponent.GoodsClass.ToString() : "";

                kitRequieredString = dd.Kits.Count + " kits";
                manHours           = dd.ManHours;
                cost          = dd.Cost;
                zone          = dd.ZoneArea;
                access        = dd.AccessDirective;
                remarks       = dd.Remarks;
                hiddenRemarks = dd.HiddenRemarks;
                workType      = dd.DirectiveType.ToString();
                ndtString     = dd.NDTType.ShortName;
                condition     = !firstPerformance.IsNullOrZero() ? (dd.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";
                conditionRepeat = !dd.Threshold.RepeatInterval.IsNullOrZero() ? (dd.Threshold.RepeatPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                        ? "/WF"
                                        : "/WL") : "";



                if (dd.IsExpiry)
                {
                    expiryDate   = dd.IsExpiry ? (dd.ExpiryDate.HasValue ? SmartCore.Auxiliary.Convert.GetDateFormat(dd.ExpiryDate.Value) : "") : "";
                    expiryRemain = dd.IsExpiry ? new Lifelength((int)(dd.ExpiryDate.Value - DateTime.Today).TotalDays, 0, 0) : Lifelength.Null;
                }

                if (dd.MaintenanceDirective != null)
                {
                    mpdString    = dd.MaintenanceDirective.TaskNumberCheck;
                    mpdNumString = dd.MaintenanceDirective.TaskCardNumber;
                }
            }
            if (ShowGroup)
            {
                subItems.Add(CreateRow(type, type));
            }
            subItems.Add(CreateRow(ata.ToString(), ata));
            subItems.Add(CreateRow(partNumber, partNumber));
            subItems.Add(CreateRow(description, description));
            subItems.Add(CreateRow(workType, workType));
            subItems.Add(CreateRow(serialNumber, serialNumber));
            subItems.Add(CreateRow(mpdString, mpdString));
            subItems.Add(CreateRow(mpdNumString, mpdNumString));
            subItems.Add(CreateRow(position, position));
            subItems.Add(CreateRow(maintenanceType.ShortName, maintenanceType));
            subItems.Add(CreateRow(zone, zone));
            subItems.Add(CreateRow(access, access));
            subItems.Add(CreateRow(transferDate > DateTimeExtend.GetCASMinDateTime()
                                ? SmartCore.Auxiliary.Convert.GetDateFormat(transferDate) : "", transferDate));
            subItems.Add(CreateRow(IDD?.ToString(), IDD));
            subItems.Add(CreateRow(IDDC?.ToString(), IDDC));
            subItems.Add(CreateRow($"{firstPerformance} {condition}", firstPerformance));
            subItems.Add(CreateRow($"{repeatInterval} {conditionRepeat}", repeatInterval));


            subItems.Add(CreateRow(SmartCore.Auxiliary.Convert.GetDateFormat(nextEstimated), nextEstimated));
            subItems.Add(CreateRow(nextEstimatedData?.ToString(), nextEstimatedData));
            subItems.Add(CreateRow(nextEstimatedDataC?.ToString(), nextEstimatedDataC));
            subItems.Add(CreateRow(remainEstimated?.ToString(), remainEstimated));
            subItems.Add(CreateRow(nextLimitData?.Days != null ? SmartCore.Auxiliary.Convert.GetDateFormat(nextLimit) : "", nextLimit));
            subItems.Add(CreateRow(nextLimitData?.ToString(), nextLimitData));
            subItems.Add(CreateRow(nextLimitDataC?.ToString(), nextLimitDataC));
            subItems.Add(CreateRow(remainLimit?.ToString(), remainLimit));
            subItems.Add(CreateRow(remainLimitC?.ToString(), remainLimitC));
            subItems.Add(CreateRow(lastPerformanceString, lastPerformanceDate));
            subItems.Add(CreateRow(lastPerformanceC?.ToString(), lastPerformanceC));
            subItems.Add(CreateRow(lastPerformance?.ToString(), lastPerformance));


            subItems.Add(CreateRow(expiryDate, expiryDate));
            subItems.Add(CreateRow(!expiryRemain.IsNullOrZero() ? $"{expiryRemain?.Days}d" : "", expiryRemain));
            subItems.Add(CreateRow(warranty.ToString(), warranty));
            subItems.Add(CreateRow(classString, classString));
            subItems.Add(CreateRow(kitRequieredString, kitRequieredString));
            subItems.Add(CreateRow(ndtString, ndtString));
            subItems.Add(CreateRow(manHours.ToString(), manHours));
            subItems.Add(CreateRow(cost.ToString(), cost));
            subItems.Add(CreateRow(costOverhaul.ToString(), costOverhaul));
            subItems.Add(CreateRow(costServiceable.ToString(), costServiceable));
            subItems.Add(CreateRow(remarks, remarks));
            subItems.Add(CreateRow(hiddenRemarks, hiddenRemarks));
            subItems.Add(CreateRow(author, author));

            return(subItems);
        }
 public static TLayout Padding <TLayout>(this TLayout layout, double horizontalSize, double verticalSize) where TLayout : Layout
 {
     layout.Padding = new Thickness(horizontalSize, verticalSize); return(layout);
 }
Esempio n. 20
0
        public override void OnRender(ChartControl chartControl, ChartScale chartScale, ChartBars chartBars)
        {
            Bars bars = chartBars.Bars;

            if (chartBars.FromIndex > 0)
            {
                chartBars.FromIndex--;
            }

            SharpDX.Direct2D1.PathGeometry lineGeometry = new SharpDX.Direct2D1.PathGeometry(Core.Globals.D2DFactory);
            AntialiasMode oldAliasMode = RenderTarget.AntialiasMode;
            GeometrySink  sink         = lineGeometry.Open();

            sink.BeginFigure(new Vector2(chartControl.GetXByBarIndex(chartBars, chartBars.FromIndex > -1 ? chartBars.FromIndex : 0), chartScale.GetYByValue(bars.GetClose(chartBars.FromIndex > -1 ? chartBars.FromIndex : 0))), FigureBegin.Filled);

            for (int idx = chartBars.FromIndex + 1; idx <= chartBars.ToIndex; idx++)
            {
                double closeValue = bars.GetClose(idx);
                float  close      = chartScale.GetYByValue(closeValue);
                float  x          = chartControl.GetXByBarIndex(chartBars, idx);
                sink.AddLine(new Vector2(x, close));
            }

            sink.EndFigure(FigureEnd.Open);
            sink.Close();
            RenderTarget.AntialiasMode = AntialiasMode.PerPrimitive;
            RenderTarget.DrawGeometry(lineGeometry, UpBrushDX, (float)Math.Max(1, chartBars.Properties.ChartStyle.BarWidth));
            lineGeometry.Dispose();

            SharpDX.Direct2D1.SolidColorBrush fillOutline  = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, SharpDX.Color.Transparent);
            SharpDX.Direct2D1.PathGeometry    fillGeometry = new SharpDX.Direct2D1.PathGeometry(Core.Globals.D2DFactory);
            GeometrySink fillSink = fillGeometry.Open();

            fillSink.BeginFigure(new Vector2(chartControl.GetXByBarIndex(chartBars, chartBars.FromIndex > -1 ? chartBars.FromIndex : 0), chartScale.GetYByValue(chartScale.MinValue)), FigureBegin.Filled);
            float fillx = float.NaN;

            for (int idx = chartBars.FromIndex; idx <= chartBars.ToIndex; idx++)
            {
                double closeValue = bars.GetClose(idx);
                float  close      = chartScale.GetYByValue(closeValue);
                fillx = chartControl.GetXByBarIndex(chartBars, idx);
                fillSink.AddLine(new Vector2(fillx, close));
            }
            if (!double.IsNaN(fillx))
            {
                fillSink.AddLine(new Vector2(fillx, chartScale.GetYByValue(chartScale.MinValue)));
            }

            fillSink.EndFigure(FigureEnd.Open);
            fillSink.Close();
            DownBrushDX.Opacity = Opacity / 100f;
            if (!(DownBrushDX is SharpDX.Direct2D1.SolidColorBrush))
            {
                TransformBrush(DownBrushDX, new RectangleF(0, 0, (float)chartScale.Width, (float)chartScale.Height));
            }
            RenderTarget.FillGeometry(fillGeometry, DownBrushDX);
            RenderTarget.DrawGeometry(fillGeometry, fillOutline, (float)chartBars.Properties.ChartStyle.BarWidth);
            fillOutline.Dispose();
            RenderTarget.AntialiasMode = oldAliasMode;
            fillGeometry.Dispose();
        }
 public static TElement MinHeight <TElement>(this TElement element, double request) where TElement : VisualElement
 {
     element.MinimumHeightRequest = request; return(element);
 }
Esempio n. 22
0
 public GradientStop GradientStop(double offset, string stopColor, double stopOpacity = 1)
 {
     return new GradientStop { Offset = offset, StopColor = stopColor, StopOpacity = stopOpacity };
 }
 public static TElement MinSize <TElement>(this TElement element, double widthRequest, double heightRequest) where TElement : VisualElement => element.MinWidth(widthRequest).MinHeight(heightRequest);
Esempio n. 24
0
		public static DefaultMotionState CreateMotionState(double px, double py, double pz, double rx, double ry, double rz, double rw)
		{
			//KinematicCharacterController c;// = new KinematicCharacterController(
			//c.
			Matrix tr = Matrix.Translation((float)px, (float)py, (float)pz);
			Matrix rot = Matrix.RotationQuaternion(new Quaternion((float)rx, (float)ry, (float)rz, (float)rw));
			return new DefaultMotionState(Matrix.Multiply(rot, tr));
		}
 public static Label FontSize(this Label label, double fontSize)
 {
     label.FontSize = fontSize; return(label);
 }
Esempio n. 26
0
		public static void Metric(string name, double value)
		{
			TelemetryClient.TrackMetric(name, value);
		}
Esempio n. 27
0
        protected override double InnerEdgeFlux(ref BoSSS.Foundation.CommonParams inp, double[] Uin, double[] Uout)
        {
            if (basecall)
            {
                return(base.InnerEdgeFlux(ref inp, Uin, Uout));
            }
            else
            {
                double   UinBkUp            = Uin[0];
                double   UoutBkUp           = Uout[0];
                double[] InParamsBkup       = inp.Parameters_IN;
                double[] OutParamsBkup      = inp.Parameters_OUT;
                int      m_SpatialDimension = Uin.Length;

                // subgrid boundary handling
                // -------------------------

                if (inp.iEdge >= 0 && inp.jCellOut >= 0)
                {
                    bool CellIn  = SubGrdMask[inp.jCellIn];
                    bool CellOut = SubGrdMask[inp.jCellOut];
                    Debug.Assert(CellIn || CellOut, "at least one cell must be in the subgrid!");

                    if (CellOut == true && CellIn == false)
                    {
                        // IN-cell is outside of subgrid: extrapolate from OUT-cell!
                        Uin[0]            = Uout[0];
                        inp.Parameters_IN = inp.Parameters_OUT.CloneAs();
                    }
                    if (CellIn == true && CellOut == false)
                    {
                        // ... and vice-versa
                        Uout[0]            = Uin[0];
                        inp.Parameters_OUT = inp.Parameters_IN.CloneAs();
                    }
                }

                // evaluate flux function
                // ----------------------

                double flx = 0.0;

                // Calculate central part
                // ======================

                double rhoIn = 1.0;


                // 2 * {u_i * u_j} * n_j,
                // same as standard flux without outer values
                flx += rhoIn * Uin[0] * (inp.Parameters_IN[0] * inp.Normal[0] + inp.Parameters_IN[1] * inp.Normal[1]);
                if (m_SpatialDimension == 3)
                {
                    flx += rhoIn * Uin[0] * inp.Parameters_IN[2] * inp.Normal[2];
                }

                // Calculate dissipative part
                // ==========================

                IList <double> _VelocityMeanIn  = new List <double>();
                IList <double> _VelocityMeanOut = new List <double>();
                for (int d = 0; d < m_SpatialDimension; d++)
                {
                    _VelocityMeanIn.Add(inp.Parameters_IN[m_SpatialDimension + d]);
                    _VelocityMeanOut.Add(inp.Parameters_OUT[m_SpatialDimension + d]);
                }
                double[] VelocityMeanIn  = _VelocityMeanIn.ToArray();
                double[] VelocityMeanOut = _VelocityMeanOut.ToArray();

                flx *= base.rho;

                // cleanup mess and return
                // -----------------------

                Uout[0]            = UoutBkUp;
                Uin[0]             = UinBkUp;
                inp.Parameters_IN  = InParamsBkup;
                inp.Parameters_OUT = OutParamsBkup;

                return(flx);
            }
        }
 public ClassWithParamsInCtor(int[] parameters, double y)
 {
 }
        static Cairo.Color[,,,,] CreateColorMatrix(TextEditor editor, bool isError)
        {
            string typeString = isError ? "error" : "warning";

            Cairo.Color[,,,,] colorMatrix = new Cairo.Color[2, 2, 3, 2, 2];

            Style style = editor.ColorStyle;

            if (style == null)
            {
                style = new DefaultStyle(editor.Style);
            }

            colorMatrix [0, 0, 0, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble." + typeString + ".light.color1").Color);
            colorMatrix [0, 1, 0, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble." + typeString + ".light.color2").Color);

            colorMatrix [0, 0, 1, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble." + typeString + ".dark.color1").Color);
            colorMatrix [0, 1, 1, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble." + typeString + ".dark.color2").Color);

            colorMatrix [0, 0, 2, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble." + typeString + ".line.top").Color);
            colorMatrix [0, 1, 2, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble." + typeString + ".line.bottom").Color);

            colorMatrix [1, 0, 0, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble.inactive." + typeString + ".light.color1").Color);
            colorMatrix [1, 1, 0, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble.inactive." + typeString + ".light.color2").Color);

            colorMatrix [1, 0, 1, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble.inactive." + typeString + ".dark.color1").Color);
            colorMatrix [1, 1, 1, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble.inactive." + typeString + ".dark.color2").Color);

            colorMatrix [1, 0, 2, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble.inactive." + typeString + ".line.top").Color);
            colorMatrix [1, 1, 2, 0, 0] = Mono.TextEditor.Highlighting.Style.ToCairoColor(style.GetChunkStyle("bubble.inactive." + typeString + ".line.bottom").Color);

            double factor = 1.03;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        HslColor color = colorMatrix [i, j, k, 0, 0];
                        color.L *= factor;
                        colorMatrix [i, j, k, 1, 0] = color;
                    }
                }
            }
            var selectionColor = Style.ToCairoColor(style.Selection.BackgroundColor);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        for (int l = 0; l < 2; l++)
                        {
                            var color = colorMatrix [i, j, k, l, 0];
                            colorMatrix [i, j, k, l, 1] = new Cairo.Color((color.R + selectionColor.R * 1.5) / 2.5, (color.G + selectionColor.G * 1.5) / 2.5, (color.B + selectionColor.B * 1.5) / 2.5);
                        }
                    }
                }
            }
            return(colorMatrix);
        }
Esempio n. 30
0
 public Euro(double unidades, double cotizacion):this(cotizacion)
 {
     this.unidades = unidades;
     
 }