Example #1
0
        protected virtual string PerformItem(IProviderFacet ipf, MoveOrSwapSubstrateItem item)
        {
            UpdateObservers();

            var substID   = item.SubstID.MapNullToEmpty();
            var toLocName = item.ToSubstLocName.MapNullToEmpty();

            var desc = "{0}[{1} -> {2}]".CheckedFormat(item.GetType().GetTypeLeafName(), substID.FullName, toLocName);

            var toLocObs = GetSubstLocObserver(toLocName);

            var substObs            = new E090SubstObserver(substID);
            var substCurrentLocName = substObs.Info.LocID;
            var fromLocObs          = GetSubstLocObserver(substCurrentLocName);

            if (!substObs.Info.IsValid)
            {
                return("{0} failed: given substrate ID is not valid".CheckedFormat(desc));
            }

            if (fromLocObs == null)
            {
                return("{0} failed: given substrate's current location is not supported here [{1}]".CheckedFormat(desc, substCurrentLocName));
            }

            if (toLocObs == null)
            {
                return("{0} failed: given move to/swap at location is not supported here [{1}]".CheckedFormat(desc, toLocName));
            }

            string ec;

            if (toLocObs.IsUnoccupied)
            {
                ec = InnerPerformMoveSubstrate(ipf, substObs, fromLocObs, toLocObs, desc);
            }
            else
            {
                var swapWithSubstID  = toLocObs.ContainsSubstInfo.ObjID;
                var swapWithSubstObs = new E090SubstObserver(swapWithSubstID);

                desc = "{0}[{1} with {2} @ {3}]".CheckedFormat(item.GetType().GetTypeLeafName(), substID.FullName, swapWithSubstID.FullName, toLocName);

                ec = InnerPerformSwapSubstrates(ipf, substObs, fromLocObs, swapWithSubstObs, toLocObs, desc);
            }

            if (ec.IsNullOrEmpty())
            {
                ec = ReleaseAcquiredEndOfItemTransferPermissionsIfNeeded(ipf);
            }

            return(ec);
        }
Example #2
0
        protected virtual string PerformItem(IProviderFacet ipf, SwapSubstratesItem item)
        {
            UpdateObservers();

            var substID         = item.SubstID.MapNullToEmpty();
            var swapWithSubstID = item.SwapWithSubstID.MapNullToEmpty();

            var desc = "{0}[{1} with {2}]".CheckedFormat(item.GetType().GetTypeLeafName(), substID.FullName, swapWithSubstID.FullName);

            var substObs         = new E090SubstObserver(substID);
            var swapWithSubstObs = new E090SubstObserver(swapWithSubstID);

            if (!substObs.Info.IsValid)
            {
                return("{0} failed: given substrate ID is not valid".CheckedFormat(desc));
            }

            if (!swapWithSubstObs.Info.IsValid)
            {
                return("{0} failed: given swap with substrate ID is not valid".CheckedFormat(desc));
            }

            var substCurrentLocName         = substObs.Info.LocID;
            var swapWithSubstCurrentLocName = swapWithSubstObs.Info.LocID;

            var fromLocObs   = GetSubstLocObserver(substCurrentLocName);
            var swapAtLocObs = GetSubstLocObserver(swapWithSubstCurrentLocName);

            if (fromLocObs == null)
            {
                return("{0} failed: given substrate's current location is not supported here [{1}]".CheckedFormat(desc, substCurrentLocName));
            }

            if (swapAtLocObs == null)
            {
                return("{0} failed: given swap with substrate's current location is not supported here [{1}]".CheckedFormat(desc, swapWithSubstCurrentLocName));
            }

            string ec = InnerPerformSwapSubstrates(ipf, substObs, fromLocObs, swapWithSubstObs, swapAtLocObs, desc);

            if (ec.IsNullOrEmpty())
            {
                ec = ReleaseAcquiredEndOfItemTransferPermissionsIfNeeded(ipf);
            }

            return(ec);
        }
Example #3
0
        protected virtual string PerformItem(IProviderFacet ipf, ApproachLocationItem item)
        {
            var desc = item.ToString();

            var toLocName = item.ToSubstLocName;
            E090SubstLocObserver toLocObs = null;

            if (toLocName.IsNullOrEmpty() && !item.SubstID.IsEmpty)
            {
                var substObs = new E090SubstObserver(item.SubstID);

                if (!substObs.Info.IsValid)
                {
                    return("{0} failed: given approach substrate ID is not valid [{1}]".CheckedFormat(desc, item.SubstID));
                }

                toLocName = substObs.Info.LocID;
                toLocObs  = GetSubstLocObserver(toLocName);

                if (toLocObs == null)
                {
                    return("{0} failed: given approach substrate is not currently at a supported location [{1}]".CheckedFormat(desc, toLocName));
                }
            }
            else
            {
                toLocObs = GetSubstLocObserver(item.ToSubstLocName);

                if (toLocObs == null)
                {
                    return("{0} failed: given approach to location is not supported here [{1}]".CheckedFormat(desc, toLocName));
                }
            }

            return(InnerPerformApproach(ipf, item, toLocObs, desc));
        }
Example #4
0
 protected virtual string InnerPerformSwapSubstrates(IProviderFacet ipf, E090SubstObserver substObs, E090SubstLocObserver fromLocObs, E090SubstObserver swapWithSubstObs, E090SubstLocObserver swapAtLocObs, string desc)
 {
     return("{0}.{1} has not been implemented [{2}]".CheckedFormat(CurrentClassLeafName, CurrentMethodName, desc));
 }