public CoordinationPoint(
     bool isFirCopx,
     string departureAirportOrFixBefore,
     string departureRunway,
     string coordinationFix,
     string arrivalAirportOrFixAfter,
     string arrivalRunway,
     string fromSector,
     string toSector,
     string climbLevel,
     string descendLevel,
     string name,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     IsFirCopx = isFirCopx;
     DepartureAirportOrFixBefore = departureAirportOrFixBefore;
     DepartureRunway             = departureRunway;
     CoordinationFix             = coordinationFix;
     ArrivalAirportOrFixAfter    = arrivalAirportOrFixAfter;
     ArrivalRunway = arrivalRunway;
     FromSector    = fromSector;
     ToSector      = toSector;
     ClimbLevel    = climbLevel;
     DescendLevel  = descendLevel;
     Name          = name;
 }
        /*
         * Iterate the lines in a file.
         * - Skip any blank line
         * - Store up any full-comment lines to be turned into a DocBlock
         * - If it's a data line, yield a data item for parsing
         */
        public override IEnumerator <SectorData> GetEnumerator()
        {
            Docblock docblock = new Docblock();

            using TextReader file = this.streamFactory.GetStream(this.FullPath);
            string line;

            while ((line = file.ReadLine()) != null)
            {
                this.CurrentLineNumber++;
                if (reader.IsBlankLine(line))
                {
                    continue;
                }

                if (reader.IsCommentLine(line))
                {
                    docblock.AddLine(reader.GetCommentSegment(line));
                }
                else
                {
                    yield return(new SectorData(
                                     docblock,
                                     reader.GetCommentSegment(line),
                                     reader.GetDataSegments(line),
                                     reader.GetRawData(line),
                                     new Definition(this.FullPath, this.CurrentLineNumber)
                                     ));

                    docblock = new Docblock();
                }
            }
        }
Esempio n. 3
0
        private static void AssertExpectedDocblockLines(Docblock docblock, List <string> docblockLines)
        {
            Docblock expectedDocblock = new();

            docblockLines?.ForEach(line => docblock.AddLine(new Comment(line)));

            Assert.Equal(expectedDocblock, docblock);
        }
Esempio n. 4
0
 public InfoLatitude(
     string latitude,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     this.Latitude = latitude;
 }
 public SectorlineCoordinate(
     Coordinate coordinate,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Coordinate = coordinate;
 }
Esempio n. 6
0
 public InfoScale(
     int scale,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     this.Scale = scale;
 }
 public InfoMagneticVariation(
     double variation,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     this.Variation = variation;
 }
 public FixedColourRunwayCentreline(
     RunwayCentrelineSegment centrelineSegment,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     )
     : base(centrelineSegment, definition, docblock, inlineComment)
 {
 }
Esempio n. 9
0
 public InfoMilesPerDegreeLatitude(
     int miles,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     this.Miles = miles;
 }
 public GroundNetworkCoordinate(
     Coordinate coordinate,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Coordinate = coordinate;
 }
Esempio n. 11
0
 public RunwayCentreline(
     RunwayCentrelineSegment centrelineSegment,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     CentrelineSegment = centrelineSegment;
 }
Esempio n. 12
0
 public CentrelineStarter(
     bool isExtended,
     RunwayCentrelineSegment centrelineSegment,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(centrelineSegment, definition, docblock, inlineComment)
 {
     IsExtended = isExtended;
 }
 public SectorActive(
     string airfield,
     string runway,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Airfield = airfield;
     Runway   = runway;
 }
Esempio n. 14
0
 public Fix(
     string identifier,
     Coordinate coordinate,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Identifier = identifier;
     Coordinate = coordinate;
 }
Esempio n. 15
0
 public Colour(
     string name,
     int value,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     this.Name  = name;
     this.Value = value;
 }
Esempio n. 16
0
 public RegionPoint(
     Point point,
     Definition definition,
     Docblock docblock,
     Comment inlineComment,
     string colour = null
     )
     : base(definition, docblock, inlineComment)
 {
     Point  = point;
     Colour = colour;
 }
        public AbstractSectorElementTest()
        {
            this.docblock   = DocblockFactory.Make();
            this.comment    = CommentFactory.Make();
            this.definition = DefinitionFactory.Make();

            this.element = new MockSectorElement(
                this.definition,
                this.docblock,
                this.comment
                );
        }
Esempio n. 18
0
 public SectorlineDisplayRule(
     string controlledSector,
     string compareSectorFirst,
     string compareSectorSecond,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     ControlledSector    = controlledSector;
     CompareSectorFirst  = compareSectorFirst;
     CompareSectorSecond = compareSectorSecond;
 }
Esempio n. 19
0
 public Freetext(
     string title,
     string text,
     Coordinate coordinate,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Title      = title;
     Text       = text;
     Coordinate = coordinate;
 }
Esempio n. 20
0
 public SectorGuest(
     string controller,
     string departureAirport,
     string arrivalAirport,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Controller       = controller;
     DepartureAirport = departureAirport;
     ArrivalAirport   = arrivalAirport;
 }
Esempio n. 21
0
 public Label(
     string text,
     Coordinate position,
     string colour,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     Text     = text;
     Position = position;
     Colour   = colour;
 }
Esempio n. 22
0
 public Ndb(
     string identifier,
     string frequency,
     Coordinate coordinate,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     ) : base(definition, docblock, inlineComment)
 {
     this.Identifier = identifier;
     this.Frequency  = frequency;
     this.Coordinate = coordinate;
 }
Esempio n. 23
0
        public GeoSegment(
            Point firstPoint,
            Point secondPoint,
            string colour,
            Definition definition,
            Docblock docblock,
            Comment comment

            ) : base(definition, docblock, comment)
        {
            FirstPoint  = firstPoint;
            SecondPoint = secondPoint;
            Colour      = colour;
        }
Esempio n. 24
0
 public SectorData(
     Docblock docblock,
     Comment inlineComment,
     List <string> dataSegments,
     string rawData,
     Definition definition
     )
 {
     this.docblock      = docblock;
     this.inlineComment = inlineComment;
     this.dataSegments  = dataSegments;
     this.rawData       = rawData;
     this.definition    = definition;
 }
Esempio n. 25
0
 public ArtccSegment(
     string identifier,
     ArtccType type,
     Point startPoint,
     Point endPoint,
     Definition definition,
     Docblock docblock,
     Comment inlineComment
     )
     : base(definition, docblock, inlineComment)
 {
     Identifier = identifier;
     Type       = type;
     StartPoint = startPoint;
     EndPoint   = endPoint;
 }
Esempio n. 26
0
 public InfoName(string name, Definition definition, Docblock docblock, Comment inlineComment)
     : base(definition, docblock, inlineComment)
 {
     this.Name = name;
 }
Esempio n. 27
0
        public void ParseData(AbstractSectorDataFile data)
        {
            bool foundFirst = false;

            // Set up some variables for the first declaration line
            string     name = "";
            Point      initialFirstPoint  = new Point("");
            Point      initialSecondPoint = new Point("");
            string     initialColour      = "0";
            Definition initialDefinition  = new Definition("", 1);
            Comment    initialComment     = new Comment("");
            Docblock   initialDocblock    = new Docblock();

            List <GeoSegment> segments = new List <GeoSegment>();

            foreach (SectorData line in data)
            {
                // If not found the first item, we should check it's a name.
                if (!foundFirst)
                {
                    if (!this.IsNameSegment(line))
                    {
                        this.eventLogger.AddEvent(
                            new SyntaxError("Invalid start to geo segment, expected a name", line)
                            );
                        return;
                    }

                    foundFirst = true;

                    // Set up the segment
                    int nameEndIndex = this.GetEndOfNameIndex(line);
                    name = string.Join(' ', line.dataSegments.GetRange(0, nameEndIndex));
                    line.dataSegments.RemoveRange(0, nameEndIndex);

                    try
                    {
                        GeoSegment firstSegment = this.ParseGeoSegment(line);
                        initialFirstPoint  = firstSegment.FirstPoint;
                        initialSecondPoint = firstSegment.SecondPoint;
                        initialColour      = firstSegment.Colour;
                        initialDefinition  = firstSegment.GetDefinition();
                        initialDocblock    = firstSegment.Docblock;
                        initialComment     = firstSegment.InlineComment;
                    }
                    catch (ArgumentException)
                    {
                        // Syntax errors dealt with in segment parsing method
                        return;
                    }

                    continue;
                }

                // If it's a name segment, we should save our progress and start afresh
                if (this.IsNameSegment(line))
                {
                    // Add the full geo element
                    this.elements.Add(
                        new Geo(
                            name,
                            initialFirstPoint,
                            initialSecondPoint,
                            initialColour,
                            segments,
                            initialDefinition,
                            initialDocblock,
                            initialComment
                            )
                        );

                    // Reset the segments array
                    segments = new List <GeoSegment>();

                    // Set up the segment
                    int nameEndIndex = this.GetEndOfNameIndex(line);
                    name = string.Join(' ', line.dataSegments.GetRange(0, nameEndIndex));
                    line.dataSegments.RemoveRange(0, nameEndIndex);

                    try
                    {
                        GeoSegment firstSegment = this.ParseGeoSegment(line);
                        initialFirstPoint  = firstSegment.FirstPoint;
                        initialSecondPoint = firstSegment.SecondPoint;
                        initialColour      = firstSegment.Colour;
                        initialDefinition  = firstSegment.GetDefinition();
                        initialDocblock    = firstSegment.Docblock;
                        initialComment     = firstSegment.InlineComment;
                    }
                    catch (ArgumentException)
                    {
                        // Syntax errors dealt with in segment parsing method
                        return;
                    }

                    continue;
                }

                // Otherwise, process the segment
                try
                {
                    segments.Add(this.ParseGeoSegment(line));
                }
                catch
                {
                    // Syntax errors dealt with in segment parsing method
                    return;
                }
            }

            // Add final geo element
            this.elements.Add(
                new Geo(
                    name,
                    initialFirstPoint,
                    initialSecondPoint,
                    initialColour,
                    segments,
                    initialDefinition,
                    initialDocblock,
                    initialComment
                    )
                );
        }
Esempio n. 28
0
 public InfoAirport(string airportIcao, Definition definition, Docblock docblock, Comment inlineComment)
     : base(definition, docblock, inlineComment)
 {
     this.AirportIcao = airportIcao;
 }
Esempio n. 29
0
 public InfoCallsign(string callsign, Definition definition, Docblock docblock, Comment inlineComment)
     : base(definition, docblock, inlineComment)
 {
     this.Callsign = callsign;
 }
 public MockSectorElement(Definition definition, Docblock docblock, Comment inlineComment)
     : base(definition, docblock, inlineComment)
 {
 }