public MakeFloat4Node(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { //we ignore w,h,p CanPreview = false; Name = "Make Float4"; Id = Guid.NewGuid().ToString(); shaderId = "S" + Id.Split('-')[0]; vec = new MVector(); input = new NodeInput(NodeType.Float, this, "X (Float)"); input2 = new NodeInput(NodeType.Float, this, "Y (Float)"); input3 = new NodeInput(NodeType.Float, this, "Z (Float)"); input4 = new NodeInput(NodeType.Float, this, "W (Float)"); output = new NodeOutput(NodeType.Float4, this); Inputs.Add(input); Inputs.Add(input2); Inputs.Add(input3); Inputs.Add(input4); input.OnInputAdded += Input_OnInputAdded; input.OnInputChanged += Input_OnInputChanged; input2.OnInputAdded += Input_OnInputAdded; input2.OnInputChanged += Input_OnInputChanged; input3.OnInputAdded += Input_OnInputAdded; input3.OnInputChanged += Input_OnInputChanged; input4.OnInputAdded += Input_OnInputAdded; input4.OnInputChanged += Input_OnInputChanged; Outputs.Add(output); }
public override void RebuildConnections(Func <object, GraphNode> lookup) { Inputs.Clear(); switch (ActionNode) { case AnyEntry asAny: { foreach (var entry in asAny.Entries) { var slot = new Slot(this, SlotType.Output); if (entry.Child) { connectedTo.Add(MakeConnection(slot, lookup.Invoke(entry.Child)?.GetDefaultInputSlot())); } Outputs.Add(slot); } break; } case EventEntry asEvent: { var slot = new Slot(this, SlotType.Output); if (asEvent.Child) { connectedTo.Add(MakeConnection(slot, lookup.Invoke(asEvent.Child)?.GetDefaultInputSlot())); } Outputs.Add(slot); break; } } }
public BreakFloat4Node(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { //we ignore w,h,p CanPreview = false; Name = "Break Float4"; Id = Guid.NewGuid().ToString(); shaderId = "S" + Id.Split('-')[0]; input = new NodeInput(NodeType.Float4, this, "Float4 Type"); output = new NodeOutput(NodeType.Float, this, "X"); output2 = new NodeOutput(NodeType.Float, this, "Y"); output3 = new NodeOutput(NodeType.Float, this, "Z"); output4 = new NodeOutput(NodeType.Float, this, "W"); Inputs.Add(input); Outputs.Add(output); Outputs.Add(output2); Outputs.Add(output3); Outputs.Add(output4); }
/// <summary> /// Add Holiday control point info /// </summary> /// <param name="holiday">Holiday Point</param> /// <param name="index">Index</param> public void Add(HolidayPoint holiday, int index) { try { ControlPointInfo newCPInfo = new ControlPointInfo { ControlPointName = "HOL" + index, Label = holiday.Label, FullLabel = holiday.Description, Type = IdentifierTypes.HOLS, Value = "", Units = "", AutoManual = holiday.AutoManual == 0 ? "Auto" : "Manual", Index = (short)index }; Outputs.Add(newCPInfo); } catch (Exception ex) { ExceptionHandler.Show(ex, "Addition of new Holiday to ControlPointsInfo"); } }
public AndNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { //we ignore w,h,p CanPreview = false; Name = "And"; Id = Guid.NewGuid().ToString(); shaderId = "S" + Id.Split('-')[0]; output = new NodeOutput(NodeType.Bool, this); for (int i = 0; i < 2; i++) { var input = new NodeInput(NodeType.Bool, this, "Bool Input " + i); Inputs.Add(input); input.OnInputAdded += Input_OnInputAdded; input.OnInputChanged += Input_OnInputChanged; input.OnInputRemoved += Input_OnInputRemoved; } Outputs.Add(output); }
public VisionOperation() { //创建运行时/配置窗口控件 var runningSmartWindow = new HSmartWindowControlWPF(); runningSmartWindow.HInitWindow += RunningSmartWindow_HInitWindow; runningSmartWindow.Unloaded += RunningSmartWindow_Unloaded; RunningWindow = runningSmartWindow; var configSmartWindow = new HSmartWindowControlWPF(); configSmartWindow.HInitWindow += ConfigSmartWindow_HInitWindow; configSmartWindow.Unloaded += ConfigSmartWindow_Unloaded; ConfigWindow = configSmartWindow; //配置输入参数 Inputs.Clear(); //配置输出参数 Outputs.Clear(); //Outputs.Add(new ItemBase("ItemCount", 0, typeof(int), "物料数量")); Outputs.Add(new ItemBase("ItemLocation", new Location[0], typeof(Location[]), "物料位置(数组)")); }
public BlockSeries() { InitializeComponent(); //Input - DONE Inputs.Add(new ComboBoxValueInput("Block.Genre", cbGenre)); //Output - 2 Outputs.Add(new ModelPopulatedComboBox <Genre>("Block.Genre", cbGenre)); Outputs.Add(new DataGridOutput("Data", dgvData)); cbGenre.SelectedIndexChanged += CbGenre_SelectedIndexChanged; //Controls - 1 DONE btnSeries.Click += (X, Y) => { if (dgvData.SelectedRows.Count > 0) { ViewManager.CurrentMap.SetInput("Block.Series", DataAccess.FromPrimaryKey <Model.BlockSeries>(dgvData.SelectedRows[0].Cells["clmSeriesId"].Value)); AttemptAction("goto_blocks_queries"); } }; btnAddSeries.Click += (X, Y) => AttemptAction("goto_add_series"); }
public LevelsNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { Name = "Levels"; Id = Guid.NewGuid().ToString(); width = w; height = h; tileX = tileY = 1; range = new MultiRange(); previewProcessor = new BasicImageRenderer(); processor = new LevelsProcessor(); internalPixelType = p; input = new NodeInput(NodeType.Color | NodeType.Gray, this, "Image Input"); Output = new NodeOutput(NodeType.Color | NodeType.Gray, this); Inputs.Add(input); Outputs.Add(Output); }
public Vec3UnpackNodeViewModel() { this.Name = "Unpack Vec3"; VectorInput.Name = "Vec3"; VectorInput.Editor = null; Inputs.Add(VectorInput); X.Name = "X"; X.ReturnType = typeof(float); X.Value = this.WhenAnyValue(vm => vm.VectorInput.Value).Select(v => v == null ? null : new ShaderFunc(() => $"({v.Compile()}).x")); Outputs.Add(X); Y.Name = "Y"; Y.ReturnType = typeof(float); Y.Value = this.WhenAnyValue(vm => vm.VectorInput.Value).Select(v => v == null ? null : new ShaderFunc(() => $"({v.Compile()}).y")); Outputs.Add(Y); Z.Name = "Z"; Z.ReturnType = typeof(float); Z.Value = this.WhenAnyValue(vm => vm.VectorInput.Value).Select(v => v == null ? null : new ShaderFunc(() => $"({v.Compile()}).z")); Outputs.Add(Z); }
public EventToButtonNode() { Name = "Event To Button"; var input = new ValueNodeInputViewModel <DateTime?>() { Name = "Input", }; Inputs.Add(input); input.ValueChanged.Subscribe(newValue => { _output.OnNext(true); ThreadPool.QueueUserWorkItem(cb => ReleaseButton()); }); Outputs.Add(new ValueNodeOutputViewModel <bool?> { Name = "Output", Port = new ButtonPortViewModel(), Value = _output }); }
public AutoSuture2() { this.TypeName = "AutoSuture"; this.PluginInfo = ""; InitializeComponent(); // OUTPUTS Outputs.Add("X", new ViewModel.OutputSignalViewModel("X")); Outputs.Add("Y", new ViewModel.OutputSignalViewModel("Y")); Outputs.Add("Z", new ViewModel.OutputSignalViewModel("Z")); Outputs.Add("Twist", new ViewModel.OutputSignalViewModel("Twist")); Outputs.Add("Trajectory_X", new ViewModel.OutputSignalViewModel("Trajectory_X")); Outputs.Add("Trajectory_Y", new ViewModel.OutputSignalViewModel("Trajectory_Y")); Outputs.Add("Trajectory_Z", new ViewModel.OutputSignalViewModel("Trajectory_Z")); Outputs.Add("Trajectory_Twist", new ViewModel.OutputSignalViewModel("Trajectory_Twist")); Outputs.Add("Clutch", new ViewModel.OutputSignalViewModel("Clutch")); // INPUTS Inputs.Add("X", new ViewModel.InputSignalViewModel("X", this.InstanceName)); Inputs.Add("Y", new ViewModel.InputSignalViewModel("Y", this.InstanceName)); Inputs.Add("Z", new ViewModel.InputSignalViewModel("Z", this.InstanceName)); Inputs.Add("Roll/Twist", new ViewModel.InputSignalViewModel("Roll/Twist", this.InstanceName)); Inputs.Add("Entry", new ViewModel.InputSignalViewModel("Entry", this.InstanceName)); Inputs.Add("Exit", new ViewModel.InputSignalViewModel("Exit", this.InstanceName)); Inputs.Add("leftUpperBevel", new ViewModel.InputSignalViewModel("leftUpperBevel", this.InstanceName)); Inputs.Add("leftLowerBevel", new ViewModel.InputSignalViewModel("leftLowerBevel", this.InstanceName)); Inputs.Add("leftElbow", new ViewModel.InputSignalViewModel("leftElbow", this.InstanceName)); //End Sutring button EndSuturingButton.IsEnabled = false; // set up output timer for performing suturing stepTimer.Interval = 100; stepTimer.Tick += StepTimer_Tick; PostLoadSetup(); }
public PathPusher() { this.TypeName = "Path Pusher"; // set up outputs for two armed 5DOF robot Outputs.Add("XR", new OutputSignalViewModel("X Right")); Outputs.Add("YR", new OutputSignalViewModel("Y Right")); Outputs.Add("ZR", new OutputSignalViewModel("Z Right")); Outputs.Add("ToolTwistR", new OutputSignalViewModel("Tool Twist Right")); Outputs.Add("ToolActionR", new OutputSignalViewModel("Tool Actuation Right")); Outputs.Add("XL", new OutputSignalViewModel("X Left")); Outputs.Add("YL", new OutputSignalViewModel("Y Left")); Outputs.Add("ZL", new OutputSignalViewModel("Z Left")); Outputs.Add("ToolTwistL", new OutputSignalViewModel("Tool Twist Left")); Outputs.Add("ToolActionL", new OutputSignalViewModel("Tool Actuation Left")); // set up output timer stepTimer.Interval = timerInterval; stepTimer.Tick += stepTimer_Tick; // find path files in RobotApp\bin\RobotPathFiles string searchDirectory = Directory.GetCurrentDirectory() + "\\RobotPathFiles"; ReportList = new DirectoryInfo(searchDirectory).GetFiles("*.lou"); InitializeComponent(); }
public SwitchNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { Name = "Switch"; Id = Guid.NewGuid().ToString(); width = w; height = h; selected = SwitchInput.Input0; tileX = tileY = 1; internalPixelType = p; previewProcessor = new BasicImageRenderer(); input = new NodeInput(NodeType.Gray | NodeType.Color, this, "Input 0"); input2 = new NodeInput(NodeType.Gray | NodeType.Color, this, "Input 1"); Output = new NodeOutput(NodeType.Color | NodeType.Gray, this); Inputs.Add(input); Inputs.Add(input2); Outputs.Add(Output); }
public VisionOperation() { //创建运行时/配置窗口控件 var runningSmartWindow = new HSmartWindowControlWPF(); runningSmartWindow.HInitWindow += RunningSmartWindow_HInitWindow; runningSmartWindow.Unloaded += RunningSmartWindow_Unloaded; RunningWindow = runningSmartWindow; var configSmartWindow = new HSmartWindowControlWPF(); configSmartWindow.HInitWindow += ConfigSmartWindow_HInitWindow; configSmartWindow.Unloaded += ConfigSmartWindow_Unloaded; ConfigWindow = configSmartWindow; //配置输入参数 Inputs.Clear(); Inputs.Add(new ItemBase("ModelPath", @"C:\Users\Public\Documents\MVTec\HALCON-17.12-Progress\examples\hdevelop\Matching\Deformable\brake_disk_bike.dxf", typeof(string), "模板文件(.dxf)路径")); //配置输出参数 Outputs.Clear(); Outputs.Add(new ItemBase("MatchCount", typeof(int), "匹配数量")); Outputs.Add(new ItemBase("Scores", typeof(double[]), "匹配分数(List列表)")); }
public BlurNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { Name = "Blur"; Id = Guid.NewGuid().ToString(); tileX = tileY = 1; width = w; height = h; intensity = 10; internalPixelType = p; previewProcessor = new BasicImageRenderer(); processor = new BlurProcessor(); input = new NodeInput(NodeType.Color | NodeType.Gray, this, "Image Input"); Output = new NodeOutput(NodeType.Color | NodeType.Gray, this); Inputs.Add(input); Outputs.Add(Output); }
public HSLNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { Name = "HSL"; Id = Guid.NewGuid().ToString(); width = w; height = h; tileX = tileY = 1; previewProcessor = new BasicImageRenderer(); processor = new HSLProcessor(); hue = 0; saturation = 0; lightness = 0; internalPixelType = p; input = new NodeInput(NodeType.Gray | NodeType.Color, this, "Image"); Output = new NodeOutput(NodeType.Color, this); Inputs.Add(input); Outputs.Add(Output); }
private void GenerateRand(int inputs, List <int> hiddenLayers, int outputs, int memory) { for (int i = 0; i < inputs; i++) { Inputs.Add(new Neuron()); } for (int i = 0; i < memory; i++) { Memory.Add(new Neuron(hiddenLayers[hiddenLayers.Count - 1], 0, NeuronType.MEMORY)); } for (int i = 0; i < hiddenLayers.Count; i++) { for (int j = 0; j < hiddenLayers[i]; j++) { var value = GetRandomWeight(); var prevLayer = i == 0 ? Inputs.Concat(Memory).ToList() : HiddenLayers[i - 1]; HiddenLayers[i].Add(new Neuron(prevLayer.Count, value, NeuronType.HIDDEN)); } } for (int i = 0; i < outputs; i++) { Outputs.Add(new Neuron(hiddenLayers[hiddenLayers.Count - 1], 0, NeuronType.OUTPUT)); } }
/// <summary> /// Create a new GeomagicTouch. /// /// This function only runs when creating new instances of this class -- it does *not* run when instances of this class are deserialized. /// </summary> public GeomagicTouch() { this.DataContext = this; InitializeComponent(); DeviceNames = new ObservableCollection <string>(); Outputs.Add("X", new OutputSignalViewModel("X Position")); Outputs.Add("Y", new OutputSignalViewModel("Y Position")); Outputs.Add("Z", new OutputSignalViewModel("Z Position")); Outputs.Add("Theta1", new OutputSignalViewModel("Pitch / Theta 1")); Outputs.Add("Theta2", new OutputSignalViewModel("Yaw / Theta 2")); Outputs.Add("Theta3", new OutputSignalViewModel("Roll / Theta 3")); Outputs.Add("Inkwell", new OutputSignalViewModel("Inkwell Switch")); Outputs.Add("Button1", new OutputSignalViewModel("Button 1")); Outputs.Add("Button2", new OutputSignalViewModel("Button 2")); TypeName = "Geomagic Touch"; Inputs.Add("ForceX", new ViewModel.InputSignalViewModel("SetpointX", this.InstanceName)); Inputs.Add("ForceY", new ViewModel.InputSignalViewModel("SetpointY", this.InstanceName)); Inputs.Add("ForceZ", new ViewModel.InputSignalViewModel("SetpointZ", this.InstanceName)); Inputs.Add("HapticsEnabled", new ViewModel.InputSignalViewModel("HapticsEnabled", this.InstanceName)); // Get a list of all GeomagicTouch device names foreach (string device in GetGeomagicDevices()) { DeviceNames.Add(device); } // UpdateTimer = new System.Timers.Timer(); UpdateTimer.Tick += UpdateTimer_Tick; UpdateTimer.Interval = 15; // Call any additional setup work that needs to happen in either constructor's case, or loading the plugin from deserialization. PostLoadSetup(); }
/// <summary> /// Add Output control point info /// </summary> /// <param name="output">Output Point</param> /// <param name="index">Index</param> public void Add(OutputPoint output, int index) { try { ControlPointInfo newCPInfo = new ControlPointInfo { ControlPointName = "OUT" + index, Label = output.Label, FullLabel = output.Description, Type = IdentifierTypes.OUTS, Value = output.Value.ToString(), Units = output.Value.Unit.GetUnitsNames(null).OffOnName, AutoManual = output.AutoManual == 0 ? "Auto" : "Manual", Index = (short)index }; Outputs.Add(newCPInfo); } catch (Exception ex) { ExceptionHandler.Show(ex, "Addition of new Output to ControlPointsInfo"); } }
/// <summary> /// Initializes a new instance of the Scale class. /// </summary> public Scale() { TypeName = "Two Armed Scaling"; InstanceName = "Scaling"; Outputs.Add("X-Left", new ViewModel.OutputSignalViewModel("Scaled - X-Left")); Outputs.Add("Y-Left", new ViewModel.OutputSignalViewModel("Scaled - Y-Left")); Outputs.Add("Z-Left", new ViewModel.OutputSignalViewModel("Scaled - Z-Left")); Outputs.Add("X-Right", new ViewModel.OutputSignalViewModel("Scaled - X-Right")); Outputs.Add("Y-Right", new ViewModel.OutputSignalViewModel("Scaled - Y-Right")); Outputs.Add("Z-Right", new ViewModel.OutputSignalViewModel("Scaled - Z-Right")); Outputs.Add("Scale", new ViewModel.OutputSignalViewModel("Scale Level")); Inputs.Add("X-Left", new ViewModel.InputSignalViewModel("X-Left", this.InstanceName)); Inputs.Add("Y-Left", new ViewModel.InputSignalViewModel("Y-Left", this.InstanceName)); Inputs.Add("Z-Left", new ViewModel.InputSignalViewModel("Z-Left", this.InstanceName)); Inputs.Add("X-Right", new ViewModel.InputSignalViewModel("X-Right", this.InstanceName)); Inputs.Add("Y-Right", new ViewModel.InputSignalViewModel("Y-Right", this.InstanceName)); Inputs.Add("Z-Right", new ViewModel.InputSignalViewModel("Z-Right", this.InstanceName)); InitializeComponent(); PostLoadSetup(); }
public AxisInverterNode() { Name = "Axis\nInverter"; var input = new ValueNodeInputViewModel <short?>() { Name = "Input", Port = new AxisPortViewModel(), }; Inputs.Add(input); input.ValueChanged.Subscribe(newValue => { _output.OnNext(InvertAxis(newValue)); }); Outputs.Add(new ValueNodeOutputViewModel <short?> { Name = "Output", Port = new AxisPortViewModel(), Value = _output }); }
public DistanceNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { Name = "Distance"; Id = Guid.NewGuid().ToString(); width = w; height = h; tileX = tileY = 1; distance = 0.2f; previewProcessor = new BasicImageRenderer(); processor = new DistanceProcessor(); //distance node requires RGBA32F to compute properly internalPixelType = GraphPixelType.RGBA32F; input = new NodeInput(NodeType.Gray, this, "Mask"); input2 = new NodeInput(NodeType.Gray | NodeType.Color, this, "Source"); Output = new NodeOutput(NodeType.Gray, this); Inputs.Add(input); Inputs.Add(input2); Outputs.Add(Output); }
public void Add_OUTPUT(ControlPointInfo variable, int index) { try { ControlPointInfo newCPInfo = new ControlPointInfo { ControlPointName = "OUT" + index, Label = variable.Label, FullLabel = variable.FullLabel, Type = IdentifierTypes.OUTS, Value = variable.Value.ToString(), Units = variable.Units, AutoManual = variable.AutoManual, Index = (short)index }; Outputs.Add(newCPInfo); } catch (Exception ex) { ExceptionHandler.Show(ex, "Addition of new Variable to ControlPointsInfo"); } }
public bool ProcessTransaction(Dictionary <String, TransactionOutput> utxos) { if (!VerifySignature()) { return(false); } foreach (var input in Inputs) { input.UTXO = utxos[input.TransactionOutputId]; } var leftOver = GetInputsValue() - Amount; Id = CalculateHash(); Outputs.Add(new TransactionOutput(reciepient: Reciepient, amount: Amount, parentTransactionId: Id)); Outputs.Add(new TransactionOutput(reciepient: Sender, amount: leftOver, parentTransactionId: Id)); foreach (var transactionOutput in Outputs) { utxos[transactionOutput.Id] = transactionOutput; } foreach (var transactionInput in Inputs) { if (transactionInput.UTXO == null) { continue; } utxos.Remove(transactionInput.UTXO.Id); } return(true); }
/// <summary> /// Initializes a new instance of the Scale class. /// </summary> public PerformanceEvaluator() { TypeName = "Performance Evaluator (Message Timer)"; InstanceName = "PerformanceEvaluator"; Outputs.Add("StimulusOutput", new ViewModel.OutputSignalViewModel("StimulusOutput")); Inputs.Add("Input", new ViewModel.InputSignalViewModel("Input", this.InstanceName)); InitializeComponent(); Messenger.Default.Register <Messages.Signal>(this, Inputs["Input"].UniqueID, (message) => { if ((int)message.Value == NumberOfMessages) { stopwatch.Stop(); Ticks = stopwatch.ElapsedMilliseconds; stopwatch.Reset(); MeasuredFrequency = NumberOfMessages / Ticks; this.RaisePropertyChanged("Ticks"); this.RaisePropertyChanged("MeasuredFrequency"); } }); }
public MeshDepthNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA) : base() { Name = "Mesh Depth"; Id = Guid.NewGuid().ToString(); width = w; height = h; tileX = tileY = 1; scale = new MVector(1, 1, 1); position = new MVector(0, 0, 0); rotation = new MVector(0, 0, 0); cameraZoom = 3; previewProcessor = new BasicImageRenderer(); processor = new MeshDepthProcessor(); internalPixelType = p; Output = new NodeOutput(NodeType.Gray, this); Outputs.Add(Output); }
public SparqlSyntaxNet(string name) : base(name) { Add("select", "after", ""); Add("*", "after", "select"); Add("distinct", "after", "select"); Add("*", "after", "distinct"); Add("where", "after", "*"); Add("{", "after", "where"); Add("?s", "is-a", "subejct"); Add("?p", "is-a", "predicate"); Add("?o", "is-a", "object"); Add("subejct", "is-a", "variable"); Add("predicate", "is-a", "variable"); Add("object", "is-a", "variable"); Add("subejct", "after", "{"); Add("variable", "after", "distinct"); Add("predicate", "after", "subejct"); Add("object", "after", "predicate"); Add("}", "after", "."); Add("}", "after", "object"); Add(".", "after", "object"); Add("a", "after", "subejct"); Outputs.Add(Node("select")); Outputs.Add(Node("*")); Outputs.Add(Node("{")); Outputs.Add(Node("}")); Outputs.Add(Node("where")); Outputs.Add(Node("?s")); Outputs.Add(Node("?p")); Outputs.Add(Node("?o")); Outputs.Add(Node("distinct")); Outputs.Add(Node("a")); Outputs.Add(Node(".")); }
public override int Read() { //System.out.println("\nread"); while (true) { if (replacement != null && replacementPointer < replacement.Length) { //System.out.println(" return repl[" + replacementPointer + "]=" + replacement.chars[replacement.offset + replacementPointer]); return(replacement.Chars[replacement.Offset + replacementPointer++]); } // TODO: a more efficient approach would be Aho/Corasick's // algorithm // (http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm) // or this generalizatio: www.cis.uni-muenchen.de/people/Schulz/Pub/dictle5.ps // // I think this would be (almost?) equivalent to 1) adding // epsilon arcs from all final nodes back to the init // node in the FST, 2) adding a .* (skip any char) // loop on the initial node, and 3) determinizing // that. Then we would not have to Restart matching // at each position. int lastMatchLen = -1; CharsRef lastMatch = null; int firstCH = buffer.Get(inputOff); if (firstCH != -1) { // LUCENENET fix: Check the dictionary to ensure it contains a key before reading it. char key = Convert.ToChar((char)firstCH); if (cachedRootArcs.TryGetValue(key, out FST.Arc <CharsRef> arc) && arc != null) { if (!FST.TargetHasArcs(arc)) { // Fast pass for single character match: if (Debugging.AssertsEnabled) { Debugging.Assert(arc.IsFinal); } lastMatchLen = 1; lastMatch = arc.Output; } else { int lookahead = 0; CharsRef output = arc.Output; while (true) { lookahead++; if (arc.IsFinal) { // Match! (to node is final) lastMatchLen = lookahead; lastMatch = outputs.Add(output, arc.NextFinalOutput); // Greedy: keep searching to see if there's a // longer match... } if (!FST.TargetHasArcs(arc)) { break; } int ch = buffer.Get(inputOff + lookahead); if (ch == -1) { break; } if ((arc = map.FindTargetArc(ch, arc, scratchArc, fstReader)) == null) { // Dead end break; } output = outputs.Add(output, arc.Output); } } } } if (lastMatch != null) { inputOff += lastMatchLen; //System.out.println(" match! len=" + lastMatchLen + " repl=" + lastMatch); int diff = lastMatchLen - lastMatch.Length; if (diff != 0) { int prevCumulativeDiff = LastCumulativeDiff; if (diff > 0) { // Replacement is shorter than matched input: AddOffCorrectMap(inputOff - diff - prevCumulativeDiff, prevCumulativeDiff + diff); } else { // Replacement is longer than matched input: remap // the "extra" chars all back to the same input // offset: int outputStart = inputOff - prevCumulativeDiff; for (int extraIDX = 0; extraIDX < -diff; extraIDX++) { AddOffCorrectMap(outputStart + extraIDX, prevCumulativeDiff - extraIDX - 1); } } } replacement = lastMatch; replacementPointer = 0; } else { int ret = buffer.Get(inputOff); if (ret != -1) { inputOff++; buffer.FreeBefore(inputOff); } return(ret); } } }
public MmalVideoEncoder() : base(MmalParameters.MmalComponentDefaultVideoEncoder) { Inputs.Add(new InputPort((IntPtr)(&(*Ptr->Input[0])), this, Guid.NewGuid())); Outputs.Add(new VideoPort((IntPtr)(&(*Ptr->Output[0])), this, Guid.NewGuid())); }
public void WriteLine(string text) { Outputs.Add(text); }