public bool Remove(IEntity entity) { entity = entity.MustNotBeNull(nameof(entity)); switch (entity) { case Node node: if (node.Equals(HomeNode)) { HomeNode = null; } return(Nodes.Remove(node)); case Reflector reflector: return(Reflectors.Remove(reflector)); case Obstacle obstacle: return(Obstacles.Remove(obstacle)); case StorageRow storageRow: return(StorageRows.Remove(storageRow)); case StorageLocation storageLocation: return(StorageLocations.Remove(storageLocation)); case VirtualPoint virtualPoint: return(VirtualPoints.Remove(virtualPoint)); case NodeLink nodeLink: return(NodeLinks.Remove(nodeLink)); default: return(false); } }
// // These serializers have to be created weirdly because is a some circular references in it // static IReflector NextMappingEntryReflectorCreator(Reflectors reflectorsReference) { return(new XdrBooleanDescriminateReflector( new XdrBooleanReflector(typeof(MappingEntry), "haveNextMapping"), new Reflectors(new ClassFieldReflectors <MappingEntry>(typeof(MappingEntry), "nextMapping", reflectorsReference)), VoidReflector.Reflectors)); }
/// <summary>Gets the reflective reading from one of the reflectors.</summary> /// <param name="reflector">The reflector to read from.</param> /// <returns>A number between 0 and 1 where 0 is no reflection and 1 is maximum reflection.</returns> public double Read(Reflectors reflector) { switch (reflector) { case Reflectors.Left: return(1 - this.left.ReadProportion()); case Reflectors.Center: return(1 - this.center.ReadProportion()); case Reflectors.Right: return(1 - this.right.ReadProportion()); default: throw new ArgumentException("reflector", "You must provide a valid reflector."); } }
/// <summary> /// Gets the reflective reading from one of the reflectors. /// </summary> /// <param name="reflector">The reflector to read from.</param> /// <returns>A number between 0 and 1 where 0 is no reflection and 1 is maximum reflection.</returns> public double Read(Reflectors reflector) { switch (reflector) { case Reflectors.Left: return(1 - this.left.ReadProportion()); case Reflectors.Center: return(1 - this.center.ReadProportion()); case Reflectors.Right: return(1 - this.right.ReadProportion()); default: return(0); } }
public XdrBooleanDescriminateReflector(XdrBooleanReflector descriminate, Reflectors trueReflectors, Reflectors falseReflectors) { this.descriminate = descriminate; this.trueReflectors = trueReflectors.reflectors; this.falseReflectors = falseReflectors.reflectors; // // Determine if serialization length is fixed // if (trueReflectors.fixedSerializationLength != UInt32.MaxValue && falseReflectors.fixedSerializationLength != UInt32.MaxValue && trueReflectors.fixedSerializationLength == falseReflectors.fixedSerializationLength) { this.fixedSerializationLength = trueReflectors.fixedSerializationLength + 4; } else { this.fixedSerializationLength = UInt32.MaxValue; } }