public SupportedNode(IResultValue normalForce = null, IResultValue shearForce = null, IResultValue rotation = null) { NormalForce = normalForce ?? new NormalForce(); ShearForce = shearForce ?? new ShearForce(); LeftRotation = rotation ?? new Rotation(); RightRotation = LeftRotation; }
public override IResultValue Evaluate() { IResultValue first = First.Evaluate(); IResultValue second = Second.Evaluate(); return(new ResultString(First.Evaluate().ToString() + Second.Evaluate().ToString())); }
public SupportedNodeWithHinge(IResultValue normalForce = null, IResultValue shearForce = null, IResultValue leftRotation = null, IResultValue rightRotation = null) { NormalForce = normalForce ?? new NormalForce(); ShearForce = shearForce ?? new ShearForce(); LeftRotation = leftRotation ?? new Rotation(); RightRotation = rightRotation ?? new Rotation(); }
public ConvertingSettings(IConvertingPackageSettings convertingPackageSettings, IResultValue <IPrintersInformation> printersInformation) : this(convertingPackageSettings.PersonId, convertingPackageSettings.PdfNamingType, convertingPackageSettings.ConvertingModeTypes, convertingPackageSettings.UseDefaultSignature, printersInformation) { }
public ConvertingSettings(string personId, PdfNamingType pdfNamingType, IEnumerable <ConvertingModeType> convertingModeTypes, bool useDefaultSignature, IResultValue <IPrintersInformation> printersInformation) : base(personId, pdfNamingType, convertingModeTypes, useDefaultSignature) { PrintersInformation = printersInformation; }
/// <summary> /// Выполнить действие, вернуть результирующий ответ /// </summary> public static IResultValue <TValue> ResultValueVoidOkBad <TValue>(this IResultValue <TValue> @this, Action <TValue> actionOk, Action <IReadOnlyCollection <IErrorResult> > actionBad) => @this. VoidWhere(_ => @this.OkStatus, actionOk: _ => actionOk.Invoke(@this.Value), actionBad: _ => actionBad.Invoke(@this.Errors));
/// <summary> /// Преобразовать коллекцию ответов в ответ с коллекцией /// </summary> public static IResultCollection <T> ToResultCollection <T>(this IResultValue <IEnumerable <T> > @this, IErrorCommon errorNull = null) => @this != null ? new ResultCollection <T>(@this.OkStatus ? @this.Value : @this.Value ?? Enumerable.Empty <T>(), @this.Errors, errorNull) : throw new ArgumentNullException(nameof(@this));
public FreeNode(IResultValue horizontalDeflection = null, IResultValue verticalDeflection = null, IResultValue rotation = null) { HorizontalDeflection = horizontalDeflection ?? new HorizontalDeflection(); VerticalDeflection = verticalDeflection ?? new VerticalDeflection(); LeftRotation = rotation ?? new Rotation(); RightRotation = LeftRotation; }
/// <summary> /// Логгирование авторизации /// </summary> private static void LogAuthorize(IResultValue <string> resultToken, IAuthorizeRestService service, IBoutiqueLogger boutiqueLogger) => resultToken. ResultValueVoidOkBad(_ => boutiqueLogger. Void(_ => boutiqueLogger.ShowMessage($"Токен сервиса [{service.GetType().Name}] получен")), errors => errors. Void(_ => boutiqueLogger.ShowMessage($"Ошибка авторизации в сервисе [{service.GetType().Name}]")). Void(_ => boutiqueLogger.ShowErrors(errors)));
public Hinge(IResultValue horizontalDeflection = null, IResultValue verticalDeflection = null, IResultValue leftRotation = null, IResultValue rightRotation = null) { HorizontalDeflection = horizontalDeflection ?? new VerticalDeflection(); VerticalDeflection = verticalDeflection ?? new VerticalDeflection(); LeftRotation = leftRotation ?? new Rotation(); RightRotation = rightRotation ?? new Rotation(); }
/// <summary> /// Перезагрузить ресурсы /// </summary> public async Task ReloadResources() { _signatureNames = await GetSignatureNames(); _signaturesMicrostation = await GetSignaturesMicrostation(); _stampMicrostation = await GetStampsMicrostation(); }
public FixedNode( IResultValue normalForce = null, IResultValue shearForce = null, IResultValue bendingMoment = null) { NormalForce = normalForce ?? new NormalForce(); ShearForce = shearForce ?? new ShearForce(); BendingMoment = bendingMoment ?? new BendingMoment(); }
/// <summary> /// Получить параметры подключения к базе /// </summary> public static IResultValue <DatabaseConnection> GetDatabaseConnection(IResultValue <HostConnection> hostConnection, IResultValue <string> database, IResultValue <Authorization> authorization) => new ResultValue <Func <HostConnection, string, Authorization, DatabaseConnection> >( (hostConnectionIn, databaseIn, authorizationIn) => new DatabaseConnection(hostConnectionIn, databaseIn, authorizationIn)). ResultValueCurryOk(hostConnection). ResultValueCurryOk(database). ResultValueCurryOk(authorization). ResultValueOk(getConfiguration => getConfiguration.Invoke());
/// <summary> /// Добавить ответ со значением /// </summary> public IResultCollection <T> ConcatResultValue(IResultValue <T> resultValue) => resultValue != null ? new ResultCollection <T>(resultValue.Value != null ? Value.Concat(new List <T> { resultValue.Value }) : Value, Errors.Union(resultValue.Errors)) : throw new ArgumentNullException(nameof(resultValue));
public SleeveNode( IResultValue shearForce = null, IResultValue bendingMoment = null, IResultValue horizontalDeflection = null) { ShearForce = shearForce ?? new ShearForce(); BendingMoment = bendingMoment ?? new BendingMoment(); HorizontalDeflection = horizontalDeflection ?? new HorizontalDeflection(); }
public TelescopeNode( IResultValue normalForce = null, IResultValue bendingMoment = null, IResultValue verticalDeflection = null) { NormalForce = normalForce ?? new NormalForce(); BendingMoment = bendingMoment ?? new BendingMoment(); VerticalDeflection = verticalDeflection ?? new VerticalDeflection(); }
public PinNode( IResultValue shearForce = null, IResultValue horizontalDeflection = null, IResultValue rotation = null) { ShearForce = shearForce ?? new ShearForce(); HorizontalDeflection = horizontalDeflection ?? new HorizontalDeflection(); LeftRotation = rotation ?? new Rotation(); RightRotation = LeftRotation; }
/// <summary> /// Выполнить действие, вернуть результирующий ответ /// </summary> public static IResultValue <TValue> ResultVoid <TValue>(this IResultValue <TValue> @this, Action <TValue> action) { if (@this == null) { throw new ArgumentNullException(nameof(@this)); } action?.Invoke(@this.Value); return(@this); }
protected BaseJsonResult(IResultValue value, HttpStatusCode statusCode) : base(null, new LowerCaseJsonSerializerSettings()) { if (value == null) { throw new ArgumentNullException(nameof(value)); } this.value = value; StatusCode = (int)statusCode; }
public override IResultValue Evaluate() { IResultValue num1 = First.Evaluate(); IResultValue num2 = Second.Evaluate(); double d1 = (double)num1.ToDecimal(); double d2 = (double)num2.ToDecimal(); return(new ResultBoolean(!d1.AlmostEqualTo(d2))); }
protected override IResultValue CalculateAtPosition(double distanceFromLeftSide) { Result = new Reactions.BendingMoment(distanceFromLeftSide) { Value = 0 }; _currentLength = 0; CalculateBendingMoment(distanceFromLeftSide); return(Result); }
public FixedNode( Point position, IResultValue normalForce = null, IResultValue shearForce = null, IResultValue bendingMoment = null) : base(position) { NormalForce = normalForce ?? new NormalForce(); ShearForce = shearForce ?? new ShearForce(); BendingMoment = bendingMoment ?? new BendingMoment(); }
/// <summary> /// Sets a variable to a value /// </summary> /// <param name="varname">Variable name</param> /// <param name="value">Value to set variable to</param> public static void Set(string varname, IResultValue value) { if (ContainsVariable(varname)) { Instance[varname] = value; } else { Logger.Log(LogLevel.Error, "variable", "Variable " + varname + " does not exist."); } }
public override IResultValue Evaluate() { IResultValue res = Operand.Evaluate(); if (!((double)res.ToDecimal()).IsInteger(8)) { throw new EvaluationException(this, "Cannot use floating-point types in factorial calculation."); } return(new ResultNumberReal((decimal)MathPlus.Probability.Factorial(res.ToInteger()))); }
/// <summary> /// Печать /// </summary> private IResultValue <IFileDataSourceServer> CreatePrintingService(IDocumentLibrary documentLibrary, IStamp stamp, IFilePath filePath, ConvertingModeType convertingModeType, ColorPrintType colorPrintType, IResultValue <IPrinterInformation> printerInformation) => printerInformation. ResultVoidOk(printer => _messagingService.ShowMessage($"Установка принтера {printer.Name}")). ResultVoidOk(printer => SetDefaultPrinter(printer.Name)). ResultVoidOk(printer => _messagingService.ShowMessage($"Печать файла {filePath.FileNameClient}")). ResultValueOkBind(_ => PrintCommand(documentLibrary, stamp, filePath.FilePathServer, convertingModeType, colorPrintType, printerInformation.Value.PrefixSearchPaperSize)). ResultVoidOk(_ => _loggerService.LogByObject(LoggerLevel.Debug, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), filePath.FilePathServer)). ResultValueOk(_ => new FileDataSourceServer(filePath.FilePathServer, filePath.FilePathClient, convertingModeType, stamp.PaperSize, printerInformation.Value.Name));
/// <summary> /// Creates a variable within the registry. /// </summary> /// <param name="varname">Name of variable to create.</param> /// <param name="initialValue">Value and type to initialize to</param> public static void Create(string varname, IResultValue initialValue) { if (!ContainsVariable(varname)) { Instance.Registry.Add(varname, initialValue); } else { Logger.Log(LogLevel.Warning, "variable", "Variable " + varname + " already exists."); } }
protected override IResultValue CalculateAtPosition(double distanceFromLeftSide) { Result = new ShearForce(distanceFromLeftSide) { Value = 0 }; _currentLength = 0; CalculateShear(distanceFromLeftSide); return(Result); }
public override IResultValue Evaluate() { IResultValue res1 = First.Evaluate(); IResultValue res2 = Second.Evaluate(); if (!((double)res1.ToDecimal()).IsInteger(8) || !((double)res2.ToDecimal()).IsInteger(8)) { throw new EvaluationException(this, "Cannot use floating-point types in modulus calculation."); } return(new ResultNumberReal((decimal)(res1.ToInteger() % res2.ToInteger()))); }
public override IResultValue Evaluate() { IResultValue condition = Condition.Evaluate(); if (condition.Type != MathType.Boolean) { throw new EvaluationException(this, "Condition part of conditional operator must be boolean."); } // See what I mean here? return(condition.ToBoolean() ? OnTrue.Evaluate() : OnFalse.Evaluate()); }
/// <summary> /// Выполнить действие при отрицательном значении, вернуть результирующий ответ /// </summary> public static IResultValue <TValue> ResultVoidBad <TValue>(this IResultValue <TValue> @this, Action <IReadOnlyList <IErrorCommon> > action) { if (@this == null) { throw new ArgumentNullException(nameof(@this)); } if (@this.HasErrors) { action?.Invoke(@this.Errors); } return(@this); }