Beispiel #1
0
 public Control(string host, short port, IBoundary boundary)
 {
     this._boundary = boundary;
     this._host = host;
     Permiss();
     Connect(port);
 }
Beispiel #2
0
 public void AddNeighborBoundary(IBoundary neighbor, bool autoAdd = true)
 {
     NeighborBoundaries.Add(neighbor.Name, neighbor);
     if (autoAdd)
     {
         neighbor.AddNeighborBoundary(this, false);
     }
 }
Beispiel #3
0
 public bool Detect(IBoundary first, IBoundary second)
 {
     if (Check(first as IBoundary, second as IBoundary))
     {
         LogData();
         return(true);
     }
     return(false);
 }
 public GherkinFileGitPollingSynchronizerFactory(IGherkinFileRepository gherkinFileRepository, ICommandBuilderFactory commandBuilderFactory, IBoundaryFactory boundaryFactory, IBoundary boundary, ILogger logger, ITimeService timeService)
 {
     this.gherkinFileRepository = gherkinFileRepository;
     this.commandBuilderFactory = commandBuilderFactory;
     this.boundaryFactory = boundaryFactory;
     this.boundary = boundary;
     this.logger = logger;
     this.timeService = timeService;
 }
Beispiel #5
0
        private bool IsCentralHit(IBoundary obstacle, IBall ball)
        {
            int unit = obstacle.Boundary.Size.X / 6;

            if (ball.Boundary.Min.X >= obstacle.Boundary.Min.X + obstacle.Boundary.Size.X / 2 - unit &&
                ball.Boundary.Min.X <= obstacle.Boundary.Min.X + obstacle.Boundary.Size.X / 2 + unit)
            {
                return(true);
            }
            return(false);
        }
Beispiel #6
0
 public HtmlExportActivity
 (
     ITimeService timeService, IHtmlExportPluginConfiguration htmlExportPluginConfiguration,
     IHtmlExportService htmlExportService, IRequirementRepository requirementRepository, IRepositoryStorage repositoryStorage, IBoundary boundary
 )
     : base(timeService, htmlExportPluginConfiguration)
 {
     this.htmlExportService     = htmlExportService;
     this.requirementRepository = requirementRepository;
     this.repositoryStorage     = repositoryStorage;
     this.boundary = boundary;
     outputPath    = htmlExportPluginConfiguration.OutputPath;
 }
Beispiel #7
0
        private void BounceBall(IBoundary obstacle, IBall ball, out DegreeType type)
        {
            type = DegreeType.None;

            if (ball.Boundary.Size.X <= obstacle.Boundary.Size.X)
            {
                if (BounceSmallBallBottomOrTop(ball))
                {
                    if (IsCentralHit(obstacle, ball))
                    {
                        type = DegreeType.Centre;
                        return;
                    }

                    type = DegreeType.Average;
                    return;
                }
            }
            else
            {
                if (BounceBigBallBottomOrTop(ball))
                {
                    type = DegreeType.Centre;
                    return;
                }
            }

            if (ball.Boundary.Size.Y <= obstacle.Boundary.Size.Y)
            {
                if (BounceSmallBallLeftOrRight(ball))
                {
                    type = DegreeType.Centre;
                    return;
                }
            }
            else
            {
                if (BounceBigBallLeftOrRight(ball))
                {
                    type = DegreeType.Centre;
                    return;
                }
            }

            if (BounceBallFromCorner(ball))
            {
                type = DegreeType.Corner;
                return;
            }
        }
    /// <inheritdoc />
    public int CompareLowTo(IBoundary <T> other)
    {
        if (other is null)
        {
            throw new ArgumentNullException(nameof(other));
        }
        var c = Value.CompareTo(other.Value);

        if (Inclusive == other.Inclusive || c != 0)
        {
            return(c);
        }
        return(Inclusive && !other.Inclusive ? -1 : +1);
    }
    /// <inheritdoc />
    public int CompareHighTo(IBoundary <T> other)
    {
        if (other is null)
        {
            throw new ArgumentNullException(nameof(other));
        }
        Contract.EndContractBlock();

        var c = Value.CompareTo(other.Value);

        if (Inclusive == other.Inclusive || c != 0)
        {
            return(c);
        }
        return(Inclusive && !other.Inclusive ? +1 : -1);
    }
Beispiel #10
0
        private bool Check(IBoundary first, IBoundary second)
        {
            // second element inside first element
            bool XLeftInside = second.Boundary.Min.X >= first.Boundary.Min.X &&
                               second.Boundary.Min.X < first.Boundary.Max.X;
            bool XRightInside = second.Boundary.Max.X > first.Boundary.Min.X &&
                                second.Boundary.Max.X <= first.Boundary.Max.X;
            bool YTopInside = second.Boundary.Min.Y >= first.Boundary.Min.Y &&
                              second.Boundary.Min.Y < first.Boundary.Max.Y;
            bool YBottomInside = second.Boundary.Max.Y > first.Boundary.Min.Y &&
                                 second.Boundary.Max.Y <= first.Boundary.Max.Y;

            // second element outside first element
            bool XLeftOutside   = second.Boundary.Min.X < first.Boundary.Min.X;
            bool XRightOutside  = second.Boundary.Max.X > first.Boundary.Max.X;
            bool YTopOutside    = second.Boundary.Min.Y < first.Boundary.Min.Y;
            bool YBottomOutside = second.Boundary.Max.Y > first.Boundary.Max.Y;

            if ((XLeftInside || XRightInside) && (YTopInside || YBottomInside))
            {
                Flags.XLeftInside   = XLeftInside;
                Flags.XRightInside  = XRightInside;
                Flags.YTopInside    = YTopInside;
                Flags.YBottomInside = YBottomInside;

                Flags.XLeftOutside   = XLeftOutside;
                Flags.XRightOutside  = XRightOutside;
                Flags.YBottomOutside = YBottomOutside;
                Flags.YTopOutside    = YTopOutside;
                return(true);
            }

            if ((XLeftInside || XRightInside) && YTopOutside && YBottomOutside)
            {
                Flags.XLeftInside   = XLeftInside;
                Flags.XRightInside  = XRightInside;
                Flags.YTopInside    = YTopInside;
                Flags.YBottomInside = YBottomInside;

                Flags.XLeftOutside   = XLeftOutside;
                Flags.XRightOutside  = XRightOutside;
                Flags.YBottomOutside = YBottomOutside;
                Flags.YTopOutside    = YTopOutside;
                return(true);
            }

            if ((YTopInside || YBottomInside) && XLeftOutside && XRightOutside)
            {
                Flags.XLeftInside   = XLeftInside;
                Flags.XRightInside  = XRightInside;
                Flags.YTopInside    = YTopInside;
                Flags.YBottomInside = YBottomInside;

                Flags.XLeftOutside   = XLeftOutside;
                Flags.XRightOutside  = XRightOutside;
                Flags.YBottomOutside = YBottomOutside;
                Flags.YTopOutside    = YTopOutside;
                return(true);
            }

            return(false);
        }
 public GradeBoundary(IBoundary boundary)
     : this(boundary.Grade, boundary.MinResult)
 {
 }
 public void AddNeighborBoundary(IBoundary neighbor, bool autoAdd)
 {
     //ask about this
 }
 public ControlClient(string host, short port, IBoundary boundary)
     : base(host, port, boundary)
 {
 }
 public ControlServer(string host, short port, IBoundary boundary)
     : base(host, port, boundary)
 {
 }
 public void AddBoundary(IBoundary child)
 {
     _children.Add(child);
 }