public AcceptDriverActionsAttribute(params DriverAction[] actions) { foreach (var action in actions) { Actions |= action; } }
public static bool AcceptDriverAction(this Type type, DriverAction action) { var attribute = type.GetCustomAttribute <AcceptDriverActionsAttribute>(false); if (attribute == null && action == DriverAction.None) { return(true); } return(attribute != null && attribute.Actions.HasFlag(action)); }
public static object InvokeActionMethod(this IDDRef objRef, DriverAction action, params object[] objects) { var method = objRef.GetActionMethod(action); if (method == null) { return(null); } return(method.Invoke(objRef, objects)); }
public static Object GetRefObj(this IDDEntity domainObj, string key, DriverAction action = DriverAction.None) { var refType = domainObj.GetRefType(key, action); if (refType == null) { return(null); } return(refType.CreateInstance()); }
internal override void Try(DriverAction action) { if (!init) { throw new Exception("ContainerScope not initialized."); } if (_element != null) { _element.Try(action); } RetryUntilTimeout(action); }
public void NextAction() { if (pathfinding == null) { Start(); } switch (action) { case DriverAction.goingToGetStack: if (truck.boxStacks.Count > 0) { if (pathfinding.indoors) { StoreObjectFunction_Doorway door = dm.dispensary.Main_c.GetRandomEntryDoor(); pathfinding.GetIndoorPath(door.transform.position, ExitDispensary); } else { pathfinding.GetOutdoorPath(truck.vehicleLoadingPosition.transform.position, PickupStack); } } else { action = DriverAction.goingToTruck; NextAction(); } break; case DriverAction.droppingOffStack: if (!pathfinding.indoors) { StoreObjectFunction_Doorway door = dm.dispensary.Main_c.GetRandomEntryDoor(); pathfinding.GetOutdoorPath(door.transform.position, EnterDispensary); } else { pathfinding.GetIndoorPath(currentStack.boxStackPosition, DropStack); } break; case DriverAction.goingToTruck: if (pathfinding.indoors) { StoreObjectFunction_Doorway door = dm.dispensary.Main_c.GetRandomEntryDoor(); pathfinding.GetIndoorPath(door.transform.position, ExitDispensary); } else { pathfinding.GetOutdoorPath(truck.vehicleEnterExitPosition.transform.position, EnterTruck); } break; } }
public static Type GetRefType(string key, string typeName, DriverAction action = DriverAction.None) { var listTypeName = typeName + action.ToString(); if (ListedReferenceTypes[key].ContainsKey(listTypeName)) { return(ListedReferenceTypes[key].GetValueOrDefault(listTypeName)); } var domainType = GetDomainType(typeName); return(GetRefType(key, domainType, action)); }
/// <summary> /// Registers the given driver with the {@code DriverManager}. /// A newly-loaded driver class should call /// the method {@code registerDriver} to make itself /// known to the {@code DriverManager}. If the driver is currently /// registered, no action is taken. /// </summary> /// <param name="driver"> the new JDBC Driver that is to be registered with the /// {@code DriverManager} </param> /// <param name="da"> the {@code DriverAction} implementation to be used when /// {@code DriverManager#deregisterDriver} is called </param> /// <exception cref="SQLException"> if a database access error occurs </exception> /// <exception cref="NullPointerException"> if {@code driver} is null /// @since 1.8 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static synchronized void registerDriver(java.sql.Driver driver, DriverAction da) throws SQLException public static void RegisterDriver(java.sql.Driver driver, DriverAction da) { lock (typeof(DriverManager)) { /* Register the driver if it has not already been added to our list */ if (driver != null) { RegisteredDrivers.AddIfAbsent(new DriverInfo(driver, da)); } else { // This is for compatibility with the original DriverManager throw new NullPointerException(); } Println("registerDriver: " + driver); } }
public bool DropStack() { action = DriverAction.goingToGetStack; currentStack.handTruck = null; currentStack.SetParent(null); currentStack.SortStack(currentStack.boxStackPosition, true, true); currentStack.droppedOff = true; dm.dispensary.inventory.AddLooseBoxStack(currentStack); /*foreach (Box box in currentStack.boxList) * { * StorageBox storageBox = (StorageBox)box.product; * dm.dispensary.inventory.AddLooseBox(storageBox); * }*/ dm.dispensary.inventory.RefreshInventoryList(false); handTruck.Tip(true); NextAction(); return(true); }
public static Type GetRefType(string key, Type domainType, DriverAction action = DriverAction.None) { if (domainType == null) { return(null); } var listTypeName = domainType.Name + action.ToString(); if (ListedReferenceTypes[key].ContainsKey(listTypeName)) { return(ListedReferenceTypes[key].GetValueOrDefault(listTypeName)); } var type = GetRefTypes(key).FindRefType(domainType, action); ListedReferenceTypes[key].Add(listTypeName, type); return(type); }
public static MethodInfo GetActionMethod(this Type refType, DriverAction action) { var methods = refType.GetMethods(); foreach (var method in methods) { var attribute = method.GetCustomAttribute <AcceptDriverActionsAttribute>(false); if (attribute == null) { continue; } if (attribute.Actions.HasFlag(action)) { return(method); } } return(null); }
public AcceptDriverActionsAttribute(bool none = false) { if (none) { Actions |= DriverAction.None; } else { foreach (var action in Enum.GetValues(typeof(DriverAction))) { if (action.Equals(DriverAction.None)) { continue; } Actions |= (DriverAction)action; } } }
public bool PickupStack() { action = DriverAction.droppingOffStack; if (handTruck == null) { GameObject handTruckGO = Instantiate(db.GetStoreObject("Hand Truck").gameObject_); handTruck = handTruckGO.GetComponent <Handtruck>(); handTruck.driver = this; handTruckGO.transform.position = handTruckPosition.transform.position; } BoxStack newStack = truck.UnloadStack(); currentStack = newStack; newStack.handTruck = handTruck; newStack.SetParent(handTruck.gameObject.transform); handTruck.LoadBoxes(newStack); handTruck.transform.parent = transform; handTruck.Tip(true); NextAction(); return(true); }
public static Type FindRefType(this IEnumerable <Type> types, Type domainType, DriverAction action = DriverAction.None) { var likeTypes = types .Where(t => t.GetCustomAttribute <EntityReferenceAttribute>() != null); foreach (var type in likeTypes) { if (!type.HasDomainType(domainType)) { continue; } if (action == DriverAction.None || type.AcceptDriverAction(action)) { return(type); } } return(null); }
public static object InvokeActionMethod(this Type refType, DriverAction action, params object[] @params) { var objRef = refType.CreateInstance() as IDDRef; return(objRef.InvokeActionMethod(action, @params)); }
public void DriveSafelySwitch_Red_Returns_Stop() { DriverAction action = Flow.DriveSafelySwitch(LightColor.Red); Assert.AreEqual(DriverAction.Stop, action); }
internal abstract void Try(DriverAction action);
public void DriveSafelySwitch_Other_Returns_Unknown() { DriverAction action = Flow.DriveSafelySwitch((LightColor)42); Assert.AreEqual(DriverAction.Unknown, action); }
internal override void Try(DriverAction action) { RetryUntilTimeout(action); }
internal override void Try(DriverAction action) { action.Act(); }
internal DriverInfo(Driver driver, DriverAction action) { this.Driver = driver; Da = action; }
public static MethodInfo GetActionMethod(Type refType, DriverAction action) { return(refType.GetActionMethod(action)); }
public static object InoveActionMethod(Type refType, DriverAction action, params object[] objects) { return(refType.InvokeActionMethod(action, objects)); }
public void DriveSafelySwitch_Yellow_Returns_StopIfSafe() { DriverAction action = Flow.DriveSafelySwitch(LightColor.Yellow); Assert.AreEqual(DriverAction.StopIfSafe, action); }
public static Type GetRefType(this IDDEntity entity, string key, DriverAction action = DriverAction.None) { return(Driver.GetRefType(key, entity.GetType(), action)); }
public static MethodInfo GetActionMethod(this IDDRef objRef, DriverAction action) { return(objRef.GetType().GetActionMethod(action)); }
public void DriveSafelySwitch_Green_Returns_ProceedWithCaution() { DriverAction action = Flow.DriveSafelySwitch(LightColor.Green); Assert.AreEqual(DriverAction.ProceedWithCaution, action); }