Beispiel #1
0
 public int GetCharsToDelete(int textLength, Repetition repetition)
 {
     return(Math.Min(MaxCharactersToRemove, BaseStrategy.GetCharsToDelete(textLength, repetition)));
 }
Beispiel #2
0
 private static extern IntPtr GroupNode_Make(
     string name, Repetition repetition, IntPtr fields, int numFields, IntPtr logicalType, out IntPtr groupNode);
Beispiel #3
0
        public DB_CalendarEventFly(string EventIDData, string Name, DateTimeOffset StartData, DateTimeOffset EndData, int PriorityData, Repetition RepetitionData, Location_Elements LocationData, TimeSpan TImePerSplitData, DateTimeOffset OriginalStartData, TimeSpan EventPrepTimeData, TimeSpan Event_PreDeadlineData, bool EventRigidFlagData, int SplitData, EventDisplay UiData, MiscData NoteData, bool CompletionFlagData, long RepeatIndexData, Procrastination ProcrastinationData, NowProfile NowProfileData, int CompleteCountData, int DeletionCountData, List <string> AllUserIDs)
        {
            EventName                = Name;
            StartDateTime            = StartData;
            EndDateTime              = EndData;
            EventRepetition          = RepetitionData;
            LocationInfo             = LocationData;
            TimePerSplit             = TImePerSplitData;
            OriginalStart            = OriginalStartData;
            PrepTime                 = EventPrepTimeData;
            EventPreDeadline         = Event_PreDeadlineData;
            ProfileOfNow             = NowProfileData;
            RigidSchedule            = EventRigidFlagData;
            Complete                 = CompletionFlagData;
            CompletedCount           = CompleteCountData;
            DeletedCount             = DeletionCountData;
            ProfileOfProcrastination = ProcrastinationData;
            SubEvents                = new Dictionary <EventID, SubCalendarEvent>();
            Priority                 = PriorityData;
            isRestricted             = false;
            RepetitionSequence       = 0;
            Splits   = SplitData;
            UniqueID = new EventID(EventIDData);
            UserIDs  = AllUserIDs;

            if (EventRepetition.Enable)
            {
                EventRepetition.PopulateRepetitionParameters(this);
            }
            else
            {
                DateTimeOffset SubEventEndData   = EndData;
                DateTimeOffset SubEventStartData = SubEventEndData - TimePerSplit;
                int            i             = 0;
                int            SubEventCount = Splits - (CompletedCount + DeletedCount);
                for (int j = 0; j < SubEventCount; i++, j++)
                {
                    EventID          SubEventID     = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                    SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, false, true, AllUserIDs.ToList(), i);
                    SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }

                /*
                 * for (int j = 0; j < CompletedCount; i++, j++)
                 * {
                 *  EventID SubEventID = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                 *  SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, true, true, AllUserIDs.ToList(), 0);
                 *  SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                 * }
                 *
                 * for (int j = 0; j < DeletedCount; i++, j++)
                 * {
                 *  EventID SubEventID = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                 *  SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, true, false, AllUserIDs.ToList(), 0);
                 *  SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                 * }
                 */
            }
            UpdateLocationMatrix(myLocation);
        }
 public PrimitiveNode(
     string name, Repetition repetition, PhysicalType type, LogicalType logicalType = LogicalType.None,
     int length = -1, int precision = -1, int scale = -1)
     : this(Make(name, repetition, type, logicalType, length, precision, scale))
 {
 }
Beispiel #5
0
 public AbsolutePath([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
Beispiel #6
0
        public IParseFunction Visit(Repetition target)
        {
            var inner = target.InnerParseFunction.ApplyVisitor(this);

            return(new Repetition(inner, target.Cardinality, target.InterfaceMethod));
        }
Beispiel #7
0
 /// <summary>
 /// Visits a repetition node.
 /// </summary>
 /// <param name="repetition"></param>
 /// <param name="argument">The argument data passed by the caller.</param>
 /// <returns>The result of visiting this node.</returns>
 protected abstract TReturn VisitRepetition(Repetition <Char> repetition, TArgument argument);
Beispiel #8
0
        protected abstract void OnSetBrush(
			Canvas.ResolvedContext source, Repetition extension);
Beispiel #9
0
        public string Run(Aoc.Framework.Part part)
        {
            if (part == Aoc.Framework.Part.Part1)
            {
                long     count     = 0;
                string[] forbidden = new string[] { "ab", "cd", "pq", "xy" };
                foreach (string s in _input)
                {
                    int voyels = s.ToCharArray().Count(c => "aeiou".Contains(c));
                    if (voyels < 3)
                    {
                        continue;
                    }

                    char?repeated = Repetition.First(s, 2);
                    if (repeated == null)
                    {
                        continue;
                    }

                    bool wrong = false;
                    foreach (string f in forbidden)
                    {
                        if (s.Contains(f))
                        {
                            wrong = true;
                            break;
                        }
                    }
                    if (wrong)
                    {
                        continue;
                    }

                    count++;
                }

                return(count.ToString());
            }

            if (part == Aoc.Framework.Part.Part2)
            {
                long count = 0;
                foreach (string s in _input)
                {
                    if (!Repetition.Group(s, 2))
                    {
                        continue;
                    }

                    if (!Repetition.Spaced(s, 1))
                    {
                        continue;
                    }

                    count++;
                }

                return(count.ToString());
            }

            return("");
        }
 public virtual int GetCharsToDelete(int textLength, Repetition repetition)
 {
     return(textLength - (repetition.LeftPosition + 1) - repetition.Period);
 }
 public ChunkExtension([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
 public int GetCharsToDelete(int textLength, Repetition repetition)
 {
     return(repetition.Period * PeriodsCount);
 }
Beispiel #13
0
 public Segment([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
Beispiel #14
0
 public Token([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
Beispiel #15
0
 public DB_ProcrastinateCalendarEvent(EventID procrasstinaeAllId, EventName NameEntry, DateTimeOffset StartData, DateTimeOffset EndData, TimeSpan EventDuration, TimeSpan eventPrepTime, TimeSpan PreDeadlineTimeSpan, Repetition EventRepetitionEntry, TilerElements.Location EventLocation, EventDisplay UiData, MiscData NoteData, bool EnabledEventFlag, bool CompletionFlag, TilerUser creator, TilerUserGroup users, string timeZone, int splitCount, NowProfile nowProfile) : base(procrasstinaeAllId, NameEntry, StartData, EndData, EventDuration, eventPrepTime, PreDeadlineTimeSpan, EventRepetitionEntry, EventLocation, UiData, NoteData, EnabledEventFlag, CompletionFlag, creator, users, timeZone, splitCount, nowProfile)
 {
     UniqueID = procrasstinaeAllId;
 }
Beispiel #16
0
 public HexadecimalInt16([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
 public ReasonPhrase([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
Beispiel #18
0
        public void SetBrush(Canvas source, Repetition extension)
        {
            Contract.Requires(Thread.CurrentThread == BoundThread);
            Contract.Requires(ActiveTarget != null);
            Contract.Requires(source != null);

            if(!_IsTargetEmpty && !source.IsEmpty)
            {
                OnSetBrush(_Device2D.Resources.ResolveCanvas(source), extension);
            }
        }
Beispiel #19
0
 public void NewException1()
 {
     var r = new Repetition(null, 1, 1);
 }
 public void LogRepetition(StringBuilder text, Repetition repetition)
 {
 }
Beispiel #21
0
 public void NewException2()
 {
     var r = new Repetition(new AnySingleCharacter(), -1, 2);
 }
Beispiel #22
0
        /// <summary>
        /// Update an existing alarm
        /// </summary>
        /// <param name="alarmId"></param>
        /// <param name="enabled"></param>
        /// <param name="time"></param>
        /// <param name="repetition"></param>
        /// <returns>The updated alarm</returns>
        public async Task <Alarm> UpdateAlarm(string alarmId, bool enabled, DayTime time, Repetition repetition)
        {
            string endpoint = $"{BaseUrl}alarms/alarm/{alarmId}";

            AlarmUpdate update = new AlarmUpdate
            {
                Repetition = repetition,
                Enabled    = enabled,
                Time       = time.ToString()
            };

            return(await RequestData(endpoint,
                                     _client.RequestAsyncPut(endpoint, update, _token),
                                     _responseParser.ParseAlarm));
        }
Beispiel #23
0
 public void NewException3()
 {
     var r = new Repetition(new AnySingleCharacter(), 1, 0);
 }
Beispiel #24
0
        static public CalendarEvent InstantiateRepeatedCandidate(EventID EventIDEntry, string EventName, TimeSpan Event_Duration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, DateTimeOffset OriginalStartData, TimeSpan EventPrepTime, TimeSpan Event_PreDeadline, bool EventRigidFlag, Repetition EventRepetitionEntry, int EventSplit, Location_Elements EventLocation, bool enabledFlag, EventDisplay UiData, MiscData NoteData, bool CompletionFlag, long RepeatIndex, ConcurrentDictionary <DateTimeOffset, CalendarEvent> OrginalStartToCalendarEvent, CalendarEvent RepeatRootData)
        {
            DB_CalendarEventFly RetValue = new DB_CalendarEventFly();

            RetValue.EventName          = EventName;
            RetValue.StartDateTime      = EventStart;
            RetValue.EndDateTime        = EventDeadline;
            RetValue.EventDuration      = Event_Duration;
            RetValue.Enabled            = enabledFlag;
            RetValue.EventRepetition    = EventRepetitionEntry;
            RetValue.PrepTime           = EventPrepTime;
            RetValue.EventPreDeadline   = Event_PreDeadline;
            RetValue.RigidSchedule      = EventRigidFlag;
            RetValue.LocationInfo       = EventLocation;
            RetValue.UniqueID           = EventIDEntry;
            RetValue.UiParams           = UiData;
            RetValue.DataBlob           = NoteData;
            RetValue.Complete           = CompletionFlag;
            RetValue.RepetitionSequence = RepeatIndex;
            RetValue.OriginalStart      = OriginalStartData;
            RetValue.Splits             = EventSplit;
            RetValue.TimePerSplit       = TimeSpan.FromTicks(((RetValue.EventDuration.Ticks / RetValue.Splits)));
            RetValue.FromRepeatEvent    = true;

            /*
             * if (RetValue.EventRepetition.Enable)
             * {
             *  RetValue.Splits = EventSplit;
             *  RetValue.TimePerSplit = new TimeSpan();
             * }
             * else
             * {
             *  RetValue.Splits = EventSplit;
             * }
             */
            RetValue.SubEvents = new Dictionary <EventID, SubCalendarEvent>();

            if (!RetValue.EventRepetition.Enable)
            {
                for (int i = 0; i < RetValue.Splits; i++)
                {
                    //(TimeSpan Event_Duration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid, Location EventLocation =null, TimeLine RangeOfSubCalEvent = null)
                    EventID          SubEventID     = EventID.GenerateSubCalendarEvent(RetValue.UniqueID.ToString(), i + 1);
                    SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, RetValue.EventName, (RetValue.EndDateTime - RetValue.TimePerSplit), RetValue.EndDateTime, RetValue.Priority, RetValue.myLocation, RetValue.OriginalStart, RetValue.Preparation, RetValue.PreDeadline, RetValue.Rigid, RetValue.UIParam.createCopy(), RetValue.Notes.createCopy(), false, RetValue.ProcrastinationInfo, RetValue.NowInfo, RetValue.RangeTimeLine, true, false, true, RetValue.UserIDs, i);

                    //SubCalendarEvent newSubCalEvent = new SubCalendarEvent(RetValue.TimePerSplit, (RetValue.EndDateTime - RetValue.TimePerSplit), RetValue.End, new TimeSpan(), OriginalStartData, RetValue.UniqueID.ToString(), RetValue.RigidSchedule, RetValue.isEnabled, RetValue.UiParams, RetValue.Notes, RetValue.Complete, i+1, EventLocation, RetValue.RangeTimeLine);
                    RetValue.SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }
            }
            RetValue.EventSequence = new TimeLine(RetValue.StartDateTime, RetValue.EndDateTime);
            RetValue.RepeatRoot    = RepeatRootData;
            RetValue.UpdateLocationMatrix(RetValue.LocationInfo);


            while (!OrginalStartToCalendarEvent.TryAdd(OriginalStartData, RetValue))
            {
                Thread.Sleep(10);
            }


            return(RetValue);
        }
Beispiel #25
0
 private static extern IntPtr Node_Repetition(IntPtr node, out Repetition repetition);
Beispiel #26
0
 private static extern IntPtr PrimitiveNode_Make(
     string name, Repetition repetition, PhysicalType type, LogicalType logicalType,
     int length, int precision, int scale, out IntPtr primitiveNode);
        private static ProjectInfo CreateProjectInfo(ProjectInfoXml projectInfoXml)
        {
            List <string> allowedEnvironmentNames =
                (projectInfoXml.AllowedEnvironments ?? "")
                .Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .ToList();

            var uberDeployerAgentProjectInfoXml = projectInfoXml as UberDeployerAgentProjectInfoXml;

            if (uberDeployerAgentProjectInfoXml != null)
            {
                return
                    (new UberDeployerAgentProjectInfo(
                         uberDeployerAgentProjectInfoXml.Name,
                         uberDeployerAgentProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         uberDeployerAgentProjectInfoXml.ArtifactsRepositoryDirName,
                         uberDeployerAgentProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         uberDeployerAgentProjectInfoXml.NtServiceName,
                         uberDeployerAgentProjectInfoXml.NtServiceDirName,
                         uberDeployerAgentProjectInfoXml.NtServiceDisplayName,
                         uberDeployerAgentProjectInfoXml.NtServiceExeName,
                         uberDeployerAgentProjectInfoXml.NtServiceUserId));
            }

            var ntServiceProjectInfoXml = projectInfoXml as NtServiceProjectInfoXml;

            if (ntServiceProjectInfoXml != null)
            {
                return
                    (new NtServiceProjectInfo(
                         ntServiceProjectInfoXml.Name,
                         ntServiceProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         ntServiceProjectInfoXml.ArtifactsRepositoryDirName,
                         ntServiceProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         ntServiceProjectInfoXml.NtServiceName,
                         ntServiceProjectInfoXml.NtServiceDirName,
                         ntServiceProjectInfoXml.NtServiceDisplayName,
                         ntServiceProjectInfoXml.NtServiceExeName,
                         ntServiceProjectInfoXml.NtServiceUserId,
                         ntServiceProjectInfoXml.ExtensionsDirName,
                         ntServiceProjectInfoXml.DependentProjects));
            }

            var webAppProjectInfoXml = projectInfoXml as WebAppProjectInfoXml;

            if (webAppProjectInfoXml != null)
            {
                return
                    (new WebAppProjectInfo(
                         webAppProjectInfoXml.Name,
                         webAppProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         webAppProjectInfoXml.ArtifactsRepositoryDirName,
                         webAppProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         webAppProjectInfoXml.AppPoolId,
                         webAppProjectInfoXml.WebSiteName,
                         webAppProjectInfoXml.WebAppDirName,
                         webAppProjectInfoXml.WebAppName,
                         webAppProjectInfoXml.DependentProjects));
            }

            var schedulerAppProjectInfoXml = projectInfoXml as SchedulerAppProjectInfoXml;

            if (schedulerAppProjectInfoXml != null)
            {
                return
                    (new SchedulerAppProjectInfo(
                         schedulerAppProjectInfoXml.Name,
                         schedulerAppProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         schedulerAppProjectInfoXml.ArtifactsRepositoryDirName,
                         schedulerAppProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         schedulerAppProjectInfoXml.SchedulerAppDirName,
                         schedulerAppProjectInfoXml.SchedulerAppExeName,
                         schedulerAppProjectInfoXml.SchedulerAppTasks
                         .Select(
                             x =>
                             new SchedulerAppTask(
                                 x.Name,
                                 x.ExecutableName,
                                 x.UserId,
                                 x.ScheduledHour,
                                 x.ScheduledMinute,
                                 x.ExecutionTimeLimitInMinutes,
                                 x.Repetition.Enabled
                      ? Repetition.CreateEnabled(
                                     TimeSpan.Parse(x.Repetition.Interval),
                                     TimeSpan.Parse(x.Repetition.Duration),
                                     x.Repetition.StopAtDurationEnd)
                      : Repetition.CreatedDisabled())),
                         schedulerAppProjectInfoXml.DependentProjects));
            }

            var terminalAppProjectInfoXml = projectInfoXml as TerminalAppProjectInfoXml;

            if (terminalAppProjectInfoXml != null)
            {
                return
                    (new TerminalAppProjectInfo(
                         terminalAppProjectInfoXml.Name,
                         terminalAppProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         terminalAppProjectInfoXml.ArtifactsRepositoryDirName,
                         terminalAppProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         terminalAppProjectInfoXml.TerminalAppName,
                         terminalAppProjectInfoXml.TerminalAppDirName,
                         terminalAppProjectInfoXml.TerminalAppExeName,
                         terminalAppProjectInfoXml.DependentProjects));
            }

            var dbProjectInfoXml = projectInfoXml as DbProjectInfoXml;

            if (dbProjectInfoXml != null)
            {
                return
                    (new DbProjectInfo(
                         dbProjectInfoXml.Name,
                         dbProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         dbProjectInfoXml.ArtifactsRepositoryDirName,
                         dbProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         dbProjectInfoXml.DbName,
                         dbProjectInfoXml.DatabaseServerId,
                         dbProjectInfoXml.IsTransacional,
                         dbProjectInfoXml.DacpacFile,
                         dbProjectInfoXml.Users,
                         dbProjectInfoXml.DependentProjects));
            }

            var extensionProjectXml = projectInfoXml as ExtensionProjectInfoXml;

            if (extensionProjectXml != null)
            {
                return
                    (new ExtensionProjectInfo(
                         extensionProjectXml.Name,
                         extensionProjectXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         extensionProjectXml.ArtifactsRepositoryDirName,
                         true,
                         extensionProjectXml.ExtendedProjectName,
                         extensionProjectXml.DependentProjects));
            }

            var powerShellScriptProjectInfoXml = projectInfoXml as PowerShellScriptProjectInfoXml;

            if (powerShellScriptProjectInfoXml != null)
            {
                return
                    (new PowerShellScriptProjectInfo(
                         powerShellScriptProjectInfoXml.Name,
                         powerShellScriptProjectInfoXml.ArtifactsRepositoryName,
                         allowedEnvironmentNames,
                         powerShellScriptProjectInfoXml.ArtifactsRepositoryDirName,
                         powerShellScriptProjectInfoXml.ArtifactsAreNotEnvironmentSpecific,
                         ConvertTargetMachine(powerShellScriptProjectInfoXml.TargetMachine),
                         powerShellScriptProjectInfoXml.ScriptName,
                         powerShellScriptProjectInfoXml.IsRemote,
                         powerShellScriptProjectInfoXml.DependentProjects));
            }

            throw new NotSupportedException(string.Format("Project type '{0}' is not supported.", projectInfoXml.GetType()));
        }
Beispiel #28
0
 public ChunkSize([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
 public TrailerPart([NotNull] Repetition repetition)
     : base(repetition)
 {
 }
Beispiel #30
0
 public GroupNode(string name, Repetition repetition, IReadOnlyList <Node> fields, LogicalType?logicalType = null)
     : this(Make(name, repetition, fields, logicalType))
 {
 }
Beispiel #31
0
        /// <summary>
        /// Try to find EBNFItem which can be on right side
        /// Its part of recursion it calls GetEBNFItem
        /// </summary>
        /// <returns></returns>
        private IEBNFItem GetStartEBNFItem(string rule, List <NonTerminal> listOfExistedTerminals)
        {
            IEBNFItem result = null;

            switch (rule[0].ToString())
            {
            case "\"":
            {
                var builder = new StringBuilder();
                for (var i = 1; i < rule.Length; i++)
                {
                    if (rule[i].Equals('"'))
                    {
                        break;
                    }
                    builder.Append(rule[i]);
                }
                result = new Terminal(builder.ToString());
            }
            break;

            case var endItem when endItem.Equals(EndRecursion.Current.Notation):
                result = EndRecursion.Current;

                break;

            case var nonItem when Regex.IsMatch(nonItem.ToString(), "[a-zA-Z]"):
            {
                var builder = new StringBuilder();
                foreach (var t in rule)
                {
                    if (Regex.IsMatch(t.ToString(), @"[,;|\[\]\{\}\(\)]"))
                    {
                        break;
                    }
                    builder.Append(t);
                }
                result = (from item in listOfExistedTerminals where item.Name.Equals(builder.ToString()) select item).SingleOrDefault();
                if (result == null)
                {
                    var emptyNonTerm = this._actualDefinition.GetNewNonTerminalInstance(builder.ToString());
                    result = emptyNonTerm;
                }
            }
            break;

            case var groupItem when Regex.IsMatch(groupItem, @"[\[\{\(]"):
            {
                var restOfRepRule = rule.Substring(1, rule.Length - 1);
                switch (groupItem)
                {
                case Repetition.notation:
                    var repItem = GetEBNFItem(restOfRepRule, listOfExistedTerminals, Repetition.endNotation);
                    result = new Repetition(repItem, this._cacheLength);
                    break;

                case Optional.notation:
                    var opItem = GetEBNFItem(restOfRepRule, listOfExistedTerminals, Optional.endNotation);
                    result = new Optional(opItem);
                    break;

                case Grouping.notation:
                    var grItem = GetEBNFItem(restOfRepRule, listOfExistedTerminals, Grouping.endNotation);
                    result = new Grouping(grItem);
                    break;
                }
            }
            break;

            default:
                throw new GrammarParseException($"Grammar parse error. Can't recognize character: {rule[0]}. Check missing rules characters.", new ArgumentException());
            }
            return(result);
        }
Beispiel #32
0
        protected override void OnSetBrush(Canvas.ResolvedContext source, Repetition extension)
        {
            _ActiveBrushState.PatternSurface.SafeDispose();

            Surface2D.Description description;

            description.Device2D = _Device2D;
            description.Device3D = _Device3D;
            description.Usage = SurfaceUsage.Normal;
            description.Size = source.Region.Size;
            description.Factory2D = null;

            _ActiveBrushState.PatternSurface = Surface2D.FromDescription(ref description);

            source.Surface2D.CopyTo(source.Region, _ActiveBrushState.PatternSurface, Point.Empty);

            _ActiveBrushState.PatternRepetition = extension;

            _ActiveBrushState.BrushType = BrushType.Pattern;

            _IsBrushInvalid = true;
        }
        private bool FoundRepetition(Repetition repetition)
        {
            var exponent = new RationalNumber(Text.Length - (repetition.LeftPosition + 1), repetition.Period);

            return(DetectEqual ? exponent >= E : exponent > E);
        }