protected abstract MutableObject Mutate(MutableObject mutable);
protected override void OnProcessOutputSchema(MutableObject newSchema) { var outgoingSchema = Mutate(newSchema); Router.TransmitAllSchema(outgoingSchema); }
public override IEnumerator ReceivePayload(VisualPayload payload) { if (!SpoofData.GetFirstValue(payload.Data)) { var binsetId = BinsetIdField.GetFirstValue(payload.Data); int foundCsId; List <int> teams; if (binsetId > 0) { var command = new GetBinsetInfoCommand(binsetId); var commandIterator = CommandProcessor.Execute(command); while (commandIterator.MoveNext()) { yield return(null); } switch (command.Type) { case BinsetType.RefPatch: teams = new List <int> { 8 }; break; case BinsetType.Ref: teams = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8 }; break; case BinsetType.Rcs: teams = command.Submissions.Select(s => s.Team).Distinct().OrderBy(v => v).ToList(); break; default: throw new Exception("Unknown binset type!"); } foundCsId = command.CsId; } else { teams = new List <int> { 8 }; foundCsId = -1; } var mut = new MutableObject { { "Teams", teams }, { "CSID", foundCsId } }; InfoTarget.SetValue(mut, payload.Data); } else { InfoTarget.SetValue(new List <int> { 8 }, payload.Data); } var routerIterator = Router.TransmitAll(payload); while (routerIterator.MoveNext()) { yield return(null); } }
public MutableObject Add(MutableObject obj) { obj.Value++; return(obj); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { BandingTarget.SetValue(new ColorGradient(4), newSchema); Router.TransmitAllSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { Router.TransmitAllSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { IndexTarget.SetValue(0, newSchema); Router.TransmitAllSchema(newSchema); }
protected override MutableObject Mutate(MutableObject mutable) { return(mutable); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { MaterialTarget.SetValue(MaterialFactory.GetDefaultMaterial(), newSchema); base.OnProcessOutputSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { CsVisualizerTarget.SetValue(new CsVisContainer(), newSchema); Router.TransmitAllSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { ScaleTarget.SetValue(Vector3.zero, newSchema); Router.TransmitAllSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { BoundDataTarget.SetValue(new MutableObject(), newSchema); Router.TransmitAllSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { AssignmentTarget.SetValue(GetDefaultValue(), newSchema); Router.TransmitAllSchema(newSchema); }
public override IEnumerator ReceivePayload(VisualPayload payload) { //var outOfBoundsColor = OutOfBoundsColor.GetFirstValue( payload.Data ); var outOfBoundsReadColor = OutOfBoundsReadColor.GetFirstValue(payload.Data); var outOfBoundsWriteColor = OutOfBoundsWriteColor.GetFirstValue(payload.Data); var allocatedAlpha = AllocationAlpha.GetFirstValue(payload.Data); var valueStepSize = ValueStepSize.GetFirstValue(payload.Data); var allocationColor = AllocationColor.GetFirstValue(payload.Data); float allocH, allocS, allocV; ColorUtility.RGBToHSV(allocationColor, out allocH, out allocS, out allocV); //var readWriteDifferentiation = ReadWriteDifferentiation.GetFirstValue( payload.Data ); foreach (var entry in TraceScope.GetEntries(payload.Data)) { var memSpace = new MemorySpace(); //var saturation = Saturation.GetValue( entry ); //var hueStep = HueStepSize.GetValue( entry ); //var value = Value.GetValue( entry ); int maxIndex = MaxIndex.GetValue(entry); // match allocations and frees var allocations = new Dictionary <uint, MemorySpacePoint>(); foreach (var allocation in AllocateScope.GetEntries(entry)) { var address = AllocateAddress.GetValue(allocation); var size = AllocateSize.GetValue(allocation); var index = AllocateIndex.GetValue(allocation); var newPoint = memSpace.AddMemoryAllocation(address, size); newPoint.StartIndex = index; newPoint.EndPoint.StartIndex = index; newPoint.EndIndex = maxIndex; newPoint.EndPoint.EndIndex = maxIndex; allocations.Add(newPoint.Address, newPoint); } // assign the end indices of any allocates with matched frees foreach (var free in FreeScope.GetEntries(entry)) { var index = FreeIndex.GetValue(free); var address = FreeAddress.GetValue(free); if (allocations.ContainsKey(address)) { var matchedAllocation = allocations[address]; matchedAllocation.EndIndex = index; matchedAllocation.EndPoint.EndIndex = index; } } // import reads to the memory space var readPoints = new Dictionary <int, MemorySpacePoint>(); foreach (var read in ReadScope.GetEntries(entry)) { var address = ReadAddress.GetValue(read); var size = ReadSize.GetValue(read); var index = ReadIndex.GetValue(read); var readPoint = MemorySpacePoint.GeneratePoint(address, size); readPoint.AllIndices = index; MemorySpacePoint containingPoint; if (memSpace.IsAccessContained(readPoint, readPoint.EndPoint, out containingPoint)) { readPoint.ContainingAllocation = containingPoint; } else { var outOfBoundsAlloc = memSpace.AddMemoryAllocation(address, size, 0, maxIndex); outOfBoundsAlloc.IsOutOfBounds = true; readPoint.ContainingAllocation = outOfBoundsAlloc; } readPoints.Add(index, readPoint); } // import Writes to the memory space var writePoints = new Dictionary <int, MemorySpacePoint>(); foreach (var write in WriteScope.GetEntries(entry)) { var address = WriteAddress.GetValue(write); var size = WriteSize.GetValue(write); var index = WriteIndex.GetValue(write); var writePoint = MemorySpacePoint.GeneratePoint(address, size); writePoint.AllIndices = index; MemorySpacePoint containingPoint; if (memSpace.IsAccessContained(writePoint, writePoint.EndPoint, out containingPoint)) { writePoint.ContainingAllocation = containingPoint; } else { var outOfBoundsAlloc = memSpace.AddMemoryAllocation(address, size, 0, maxIndex); outOfBoundsAlloc.IsOutOfBounds = true; writePoint.ContainingAllocation = outOfBoundsAlloc; } writePoints.Add(index, writePoint); } // generate visual space for memory allocations (include out of bounds allocations) memSpace.SetVisualBounding(); // set colors for memory allocations (inclde out of bounds allocations with special color) //var hueRotor = HueStart.GetValue( entry ); foreach (var allocation in memSpace.RegisteredSpace.Where(s => s.IsStart)) { Color nextColor = ColorUtility.HsvtoRgb(allocH, allocS, allocV); allocV = .3f + (allocV + valueStepSize) % .7f; /*(allocation.IsOutOfBounds)? * outOfBoundsColor: * ColorUtility.HsvtoRgb(hueRotor, saturation, * value);*/ nextColor.a = allocatedAlpha; //if ( !allocation.IsOutOfBounds ) // hueRotor += hueStep; allocation.VisualColor = nextColor; } // set colors and visual locations for all reads foreach (var read in readPoints) { if (read.Value.ContainingAllocation == null) { Debug.LogError("Danger will robinson! Danger!"); } read.Value.VisualColor = outOfBoundsReadColor; // read.Value.ContainingAllocation.VisualColor == outOfBoundsColor? // outOfBoundsReadColor: // Color.Lerp( // read.Value.ContainingAllocation.VisualColor, // Color.white, readWriteDifferentiation); //read.Value.VisualStart = memSpace.AddressToVisualPosition( read.Value.Address ); //read.Value.VisualEnd = memSpace.AddressToVisualPosition( read.Value.EndPoint.Address ); read.Value.ComputeVisualPositionsFromContainer(); } // set colors and visual locations for all writes foreach (var write in writePoints) { if (write.Value.ContainingAllocation == null) { Debug.LogError("Danger will robinson! Danger!"); } write.Value.VisualColor = outOfBoundsWriteColor; // write.Value.ContainingAllocation.VisualColor == outOfBoundsColor? // outOfBoundsWriteColor: // Color.Lerp( // write.Value.ContainingAllocation.VisualColor, // Color.black, readWriteDifferentiation); write.Value.ComputeVisualPositionsFromContainer(); //write.Value.VisualStart = memSpace.AddressToVisualPosition(write.Value.Address); //write.Value.VisualEnd = memSpace.AddressToVisualPosition(write.Value.EndPoint.Address); } // FINALLY, write this information into the corresponding targets foreach (var allocation in AllocateScope.GetEntries(entry)) { var targetAddress = AllocateAddress.GetValue(allocation); //var targetIndex = AllocateIndex.GetValue( allocation ); if (!allocations.ContainsKey(targetAddress)) { throw new Exception("Allocation address not found!"); } var foundAllocation = allocations[targetAddress]; AllocateColorTarget.SetValue(foundAllocation.VisualColor, allocation); AllocatePositionTarget.SetValue(foundAllocation.VisualStart, allocation); AllocateSizeTarget.SetValue(foundAllocation.VisualEnd - foundAllocation.VisualStart, allocation); AllocateEndIndexTarget.SetValue(foundAllocation.EndIndex, allocation); } foreach (var read in ReadScope.GetEntries(entry)) { var targetIndex = ReadIndex.GetValue(read); if (!readPoints.ContainsKey(targetIndex)) { throw new Exception("Read index not found!"); } var foundRead = readPoints[targetIndex]; ReadColorTarget.SetValue(foundRead.VisualColor, read); ReadPositionTarget.SetValue(foundRead.VisualStart, read); ReadSizeTarget.SetValue(foundRead.VisualEnd - foundRead.VisualStart, read); } foreach (var write in WriteScope.GetEntries(entry)) { var targetIndex = WriteIndex.GetValue(write); if (!writePoints.ContainsKey(targetIndex)) { throw new Exception("Write index not found!"); continue; } var foundwrite = writePoints[targetIndex]; WriteColorTarget.SetValue(foundwrite.VisualColor, write); WritePositionTarget.SetValue(foundwrite.VisualStart, write); WriteSizeTarget.SetValue(foundwrite.VisualEnd - foundwrite.VisualStart, write); } // write grid lines var gridLines = new List <MutableObject>(); uint priorAddress = memSpace.RegisteredSpace.First().Address; gridLines.Add(new MutableObject { { "Visual Position", 0f }, { "Visual Weight", 1000f } }); foreach (var space in memSpace.RegisteredSpace) { if (space.IsEnd) { continue; } var newGridLine = new MutableObject { { "Visual Position", space.VisualStart }, { "Visual Weight", (float)(Mathf.Max(0, priorAddress - space.StartPoint.Address) + 1) } }; priorAddress = space.EndPoint.Address; gridLines.Add(newGridLine); } gridLines.Add(new MutableObject { { "Visual Position", 1f }, { "Visual Weight", 1000f } }); GridLinesTarget.SetValue(gridLines, entry); } var iterator = Router.TransmitAll(payload); while (iterator.MoveNext()) { yield return(null); } }
protected override void OnProcessOutputSchema(MutableObject newSchema) { QuaternionTarget.SetValue(Quaternion.identity, newSchema); Router.TransmitAllSchema(newSchema); }
protected override void OnProcessOutputSchema(MutableObject newSchema) { TargetField.SetValue("", newSchema); Router.TransmitAllSchema(newSchema); }
private void GenerateMutableDropDownItems(MutableObject schemaSegment, Stack <string> ancestorTokens, bool isGlobal) { if (schemaSegment == null) { return; } foreach (var pair in schemaSegment) { var ancestorKeys = ancestorTokens.Any() ? ancestorTokens.Reverse().Aggregate((accumulator, current) => accumulator + "." + current) + "." : string.Empty; if (pair.Value is MutableObject) { EvaluateMutableValueForAdding(ancestorKeys + pair.Key, pair.Value, isGlobal); ancestorTokens.Push(pair.Key); GenerateMutableDropDownItems(pair.Value as MutableObject, ancestorTokens, isGlobal); ancestorTokens.Pop(); } else if (pair.Value is ICollection <MutableObject> ) { EvaluateMutableValueForAdding(ancestorKeys + pair.Key + ArraySuffix, pair.Value, isGlobal); var enumerable = pair.Value as ICollection <MutableObject>; if (enumerable.Any()) { ancestorTokens.Push(pair.Key + ArraySuffix); GenerateMutableDropDownItems(enumerable.First(), ancestorTokens, isGlobal); ancestorTokens.Pop(); } } else if (pair.Value is TypeCollisionList) { EvaluateMutableValueForAdding(ancestorKeys + pair.Key, pair.Value, isGlobal); var colList = pair.Value as TypeCollisionList; foreach (var obj in colList.Objects) { if (obj is MutableObject) { ancestorTokens.Push(pair.Key); GenerateMutableDropDownItems(obj as MutableObject, ancestorTokens, isGlobal); ancestorTokens.Pop(); continue; } if (obj is ICollection <MutableObject> ) { var enumerable = obj as ICollection <MutableObject>; if (!enumerable.Any()) { continue; } ancestorTokens.Push(pair.Key + ArraySuffix); GenerateMutableDropDownItems(enumerable.First(), ancestorTokens, isGlobal); ancestorTokens.Pop(); } } } else { EvaluateMutableValueForAdding(ancestorKeys + pair.Key, pair.Value, isGlobal); } } }