public PatchCable(PlugType plugType) { this.plugType = plugType; m_destinationPlugs = new HashSet<PatchCable>(); m_incomingJacks = new HashSet<PatchCable>(); m_incomingJackValues = new Dictionary<PatchCable, float[]>(); }
private Plug LoadInputPlug(string[] data, ref int data_index, PlugType type) { Plug plug = new Plug(); plug.m_nodeId = int.Parse(data[data_index++]); plug.m_plugId = int.Parse(data[data_index++]); plug.m_plugType = type; return(plug); }
public Plug(Node node, string name, int plugIdx, MethodInfo inPlugInfo) { this.node = node; this.name = name; this.plugIdx = plugIdx; this.inPlugInfo = ""; inPlugInfo.GetParameters().ToList().ForEach(pInfo => this.inPlugInfo += $"{pInfo.ParameterType.Name}, ");; type = PlugType.In; UpdateRects(node.transform); }
public Plug(Node node, string name, int plugIdx, FieldInfo outPlugInfo) { this.node = node; this.name = name; this.plugIdx = plugIdx; this.outPlugInfo = ""; outPlugInfo.FieldType.GetMethod("Invoke").GetParameters().ToList().ForEach(pInfo => this.outPlugInfo += $"{pInfo.ParameterType.Name}, "); type = PlugType.Out; UpdateRects(node.transform); }
/// <summary>Überprüfe ob die Station die benötigten PlugTypen hat.</summary /// <param name="plugType">Zu überprüfender PlugType.</param> /// <param name="station">zu überprüfende Station.</param> /// <returns>true: falls alle PlugTyp in der Station vorhanden ist /// sonst: false</returns> private bool HasRequestedPlugs(PlugType plugType, Station station) { bool found = false; foreach (Plug plug in station.plugs) { if (plug.type.Equals(plugType)) { found = true; } } if (!found) { return false; } return true; }
/// <summary> /// Überprüft ob Buchung eingefügt werden kann und gibt dann das beste Tupel für diese Buchung zurück /// </summary> /// <param name="booking">Zu überprüfenden Buchung</param> /// <param name="schedule">Liste der bereits eingefügten Buchungen</param> /// <param name="stations">Liste der Stationen der Location</param> /// <param name="puffer">Pufferzeit in Minuten</param> /// <returns>Tupel: (true, beste Dauer, PlugType, Station, Startzeit), falls Buchung angenommen werden kann /// sonst: false</returns> private (bool, int, PlugType, Station, DateTime) BestSpotForBooking(Booking booking, List <Booking> schedule, List <Station> stations, int puffer) { bool ok = false; int bestDuration = int.MaxValue; PlugType bestPlug = booking.plugs.First(); Station bestStation = null; booking.startTime = RoundUp(booking.startTime, TimeSpan.FromMinutes(15)); DateTime bestStartTime = booking.startTime; foreach (Station station in stations) { foreach (PlugType plugType in booking.plugs) { if (HasRequestedPlugs(plugType, station)) { int duration = CalculateDuration(booking.socStart, booking.socEnd, booking.capacity, station.plugs.Find(x => x.type.Equals(plugType)).power, puffer); for (int offset = 0; booking.startTime.AddMinutes(offset + duration) < booking.endTime; offset += 15) { if (CheckCurrentBooking(schedule, booking.startTime.AddMinutes(offset), booking.startTime.AddMinutes(offset + duration), station)) { if (bestDuration > duration) { ok = true; bestDuration = duration; bestPlug = plugType; bestStation = station; bestStartTime = booking.startTime.AddMinutes(offset); break; } } } } } } return(ok, bestDuration, bestPlug, bestStation, bestStartTime); }
public static Color ColorForPlug(PlugType kind) { switch (kind) { case PlugType.MotherboardPower: return(MotherboardPower); case PlugType.USB: return(USB); case PlugType.SATAData: return(SATAData); case PlugType.SATAPower: return(SATAPower); case PlugType.CPUFan: return(CPUFan); default: return(Default); } }