示例#1
0
        protected virtual void EmptySink()
        {
            if (SinkBits == 0)
            {
                return;
            }

            if (outputDelayRemaining > 0)
            {
                return;
            }

            int dataValue = GetLargestDataValue(SinkBits);

            Data  data           = allData.ElementAt(0);
            float cruiseVelocity = data.CruiseVelocity;
            float maxVelocity    = data.MaxVelocity;

            switch (dataValue)
            {
            case 64:
                data = new DataHex(Center, cruiseVelocity, maxVelocity);
                break;

            case 8:
                data = new DataByte(Center, cruiseVelocity, maxVelocity);
                break;

            case 1:
            default:
                data = new DataBit(Center, cruiseVelocity, maxVelocity);
                break;
            }

            SinkBits -= dataValue;

            if (Sink == null)
            {
                return;
            }

            //data.Cruise();
            Sink.ReceiveData(data);
        }
示例#2
0
        protected virtual void EmptyStorage()
        {
            // Must be at capacity
            if (HasReachedCapacity == false)
            {
                return;
            }

            if (outputDelayRemaining > 0)
            {
                return;
            }

            if (StoredBits < OutputValue)
            {
                return;
            }

            Data  data           = allData.ElementAt(0);
            float cruiseVelocity = data.CruiseVelocity;
            float maxVelocity    = data.MaxVelocity;

            switch (OutputValue)
            {
            case 64:
                data = new DataHex(Center, cruiseVelocity, maxVelocity);
                break;

            case 8:
                data = new DataByte(Center, cruiseVelocity, maxVelocity);
                break;

            case 1:
            default:
                data = new DataBit(Center, cruiseVelocity, maxVelocity);
                break;
            }

            StoredBits -= OutputValue;

            TransferData(data);
        }