private void ProcessDependentSecurityLayers(string name, LayerType type, ProcessingDirection direction, List <SecurityLayer> objectList) { objectList.Add(new SecurityLayer() { Name = name, Type = type }); if (direction == ProcessingDirection.Child) { IEnumerable <ParentToChildAssociation> dependentObjects = parentToChildAssociations.Where(pca => string.Equals(pca.ParentSystemName, name, StringComparison.CurrentCultureIgnoreCase) && pca.ParentType == type); foreach (var dependentObject in dependentObjects) { ProcessDependentSecurityLayers(dependentObject.ChildSystemName, dependentObject.ChildType, ProcessingDirection.Child, objectList); } } else if (direction == ProcessingDirection.Parent) { IEnumerable <ParentToChildAssociation> dependentObjects = parentToChildAssociations.Where(pca => string.Equals(pca.ChildSystemName, name, StringComparison.CurrentCultureIgnoreCase) && pca.ChildType == type); foreach (var dependentObject in dependentObjects) { ProcessDependentSecurityLayers(dependentObject.ParentSystemName, dependentObject.ParentType, ProcessingDirection.Parent, objectList); } } }
/// <summary> /// Sub-machines are not allowed to be processed in reverse (this is slight difference from OT spec - there context transformations /// can theoretically contain <see cref="ReverseChainingContextSubstitutionTable"/>s). /// </summary> /// <param name="direction">The direction.</param> void IStateMachineBuilder.SetProcessingDirection(ProcessingDirection direction) { if (direction == ProcessingDirection.EndToStart) { throw new NotImplementedException(); } }
/// <summary> /// Initializes a new instance of the <see cref="StateMachine" /> class. This ctor is mosty for testing purposes (so a state /// machine can be easily constructed, eveb though it won't be really valid). /// </summary> /// <param name="entryState">The entry state.</param> /// <param name="processingDirection">The processing direction.</param> public StateMachine(State entryState, ProcessingDirection processingDirection = ProcessingDirection.StartToEnd) : this(new ITransition[] { }, new[] { entryState }) { var statesAndTransitions = this.AssembleComponentLists(); this.States = statesAndTransitions.Item2.ToList(); this.Transitions = statesAndTransitions.Item1.ToList(); this.ProcessingDirection = processingDirection; }
public void SetProcessingDirection(ProcessingDirection direction) { if (direction != this.ProcessingDirection && this.Paths.Count > 0) { throw new InvalidOperationException(); } this.ProcessingDirection = direction; }
/// <inheritdoc /> public void SetProcessingDirection(ProcessingDirection direction) { if (direction != this.processingDirection && this.entryState.Transitions.Count > 0) { throw new InvalidOperationException("Can't change state machine processin direction after any transitions were added to it."); } this.processingDirection = direction; }
protected override void ProcessBuffer(ProcessingDirection Direction, byte[] buffer, int offset, int count, out byte[] outBuffer, out int outCount) { outBuffer = new byte[count]; outCount = 0; for (int i = offset; i < offset + count; i++) { bool include = true; // remove characters? if (removeChar != null) { for (int j = 0; j < replaceCharSet.Length; j++) { if (buffer[i] == removeChar[j]) { include = false; break; } } } if (include) { // replace characters? if (replaceCharSet != null) { for (int j = 0; j < replaceCharSet.Length; j++) { if (buffer[i] == replaceCharSet[j].SearchChar) { outBuffer[outCount] = (byte)replaceCharSet[j].ReplaceChar; } else { outBuffer[outCount] = buffer[i]; } } } else { outBuffer[outCount] = buffer[i]; } outCount++; } } }
protected abstract void ProcessBuffer(ProcessingDirection Direction, byte[] buffer, int offset, int count, out byte[] outBuffer, out int outCount);
/// <summary> /// Initializes a new instance of the <see cref="StateMachine" /> class. /// </summary> /// <param name="transitions">The transitions.</param> /// <param name="states">The states. The first state will become entry state.</param> /// <param name="processingDirection">The processing direction.</param> public StateMachine(IEnumerable <ITransition> transitions, IEnumerable <State> states, ProcessingDirection processingDirection = ProcessingDirection.StartToEnd) { this.States = states.ToList(); this.Transitions = transitions.ToList(); this.EntryState = this.States.First(); this.AnchorPoints = new List <AnchorPoint>(); this.GlyphIdSets = new List <HashSet <ushort> >(); this.ProcessingDirection = processingDirection; }
/// <summary> /// Tests that <see cref="SubstitutionCompiler.CompileTransformation" /> calls builder correctly on given transformaton. /// </summary> /// <param name="table">The table.</param> /// <param name="expected">The expected.</param> /// <param name="expectedProcessingDirection">The expected processing direction.</param> public void TestCompileTransformation(IGlyphTransformationTable table, IEnumerable <ITransition>[] expected, ProcessingDirection expectedProcessingDirection = ProcessingDirection.StartToEnd) { var builder = new StateMachineBuilderStub(); var compiler = new SubstitutionCompiler(); compiler.CompileTransformation(table, builder); Assert.IsTrue(expected.ValuesEqual(builder.Paths, new PathEqualityComparer())); Assert.AreEqual(expectedProcessingDirection, builder.ProcessingDirection); }