//---------------------------------------------------------------------------------------- // Sales Rep COnstructer | Parameters : eCallType //---------------------------------------------------------------------------------------- public SalesRepresentative(eCallType repType) { //Initalize the Avalablity of the rep this.Avaliable = true; //set the rep type to be the rep type passed in as the parameter this.RepType = repType; }
//---------------------------------------------------------------------- //Assign Free Sales Rep | Parameters : eCallType | Return : SalesRepresentative //------------------------------------------------------------------------- public SalesRepresentative AssignFreeSalesRep(eCallType theCallType) { SalesRepresentative rep = null; //switch to assign a rep depending on the call type passed in using the GetFreeRep method switch (theCallType) { case eCallType.OtherCall: rep = GetFreeRep(OtherSalesReps); break; case eCallType.StereoCall: rep = GetFreeRep(StereoSalesReps); break; } //returns the rep return rep; }
//---------------------------------------------------------------------------------------- // Get Next Entity Method | Parameters : eCallType | Return : Entity //---------------------------------------------------------------------------------------- public Entity GetNextEntity(eCallType entityCallType) { Entity theEntity = null; //return the next entity from the queue that matches the eCallType passed in switch (entityCallType) { case eCallType.StereoCall: theEntity = StereoQueue.Dequeue(); break; case eCallType.OtherCall: theEntity = OtherQueue.Dequeue(); break; }//End Switch //retunr the entity return theEntity; }
private opCode GetLocalFunction(object @base, Type baseType, string funcName, List<object> parameters, eCallType CallType) { MemberInfo mi; mi = GetMemberInfo(baseType, funcName, parameters); if ((mi != null)) { switch (mi.MemberType) { case MemberTypes.Field: if ((CallType & eCallType.field) == 0) mTokenizer.RaiseError("Unexpected Field"); break; case MemberTypes.Method: if ((CallType & eCallType.method) == 0) mTokenizer.RaiseError("Unexpected Method"); break; case MemberTypes.Property: if ((CallType & eCallType.property) == 0) mTokenizer.RaiseError("Unexpected Property"); break; default: mTokenizer.RaiseUnexpectedToken(mi.MemberType.ToString() + " members are not supported"); break; } return opCodeCallMethod.GetNew(mTokenizer, @base, mi, parameters); } if (@base is iVariableBag) { iEvalTypedValue val = ((iVariableBag)@base).GetVariable(funcName); if ((val != null)) { return new opCodeGetVariable(val); } } return null; }
private bool EmitCallFunction(ref opCode valueLeft, string funcName, List<object> parameters, eCallType CallType, bool ErrorIfNotFound) { opCode newOpcode; if (valueLeft == null) { foreach (object functions in mEvaluator.mEnvironmentFunctionsList) { while ((functions != null)) { newOpcode = GetLocalFunction(functions, functions.GetType(), funcName, parameters, CallType); if ((newOpcode != null)) break; // TODO: might not be correct. Was : Exit For if (functions is iEvalFunctions) { functions = ((iEvalFunctions)functions).InheritedFunctions; } else { break; // TODO: might not be correct. Was : Exit Do } } } } else { newOpcode = GetLocalFunction(valueLeft, valueLeft.SystemType, funcName, parameters, CallType); } if ((newOpcode != null)) { valueLeft = newOpcode; return true; } else { if (ErrorIfNotFound) mTokenizer.RaiseError("Variable or method " + funcName + " was not found"); return false; } }
//---------------------------------------------------------------------------------------- // Increment Excessive Wait | Parameters : eCallType, double //---------------------------------------------------------------------------------------- public void IncrementExcessiveWait(eCallType entityCallType, double queueTime) { //If the queue tim is greater than 60 seconds than add the the queue time to the Other/Stereo QueueExcessiveWait if (queueTime > GlobalParameters.SEC_IN_MIN) { //determines what list to add the time to switch (entityCallType) { case eCallType.OtherCall: OtherQueueExcessiveWait.Add(queueTime); break; case eCallType.StereoCall: StereoQueueExcessiveWait.Add(queueTime); break; } } }
private opCode GetLocalFunction(object @base, Type baseType, string funcName, IList <iEvalTypedValue> parameters, eCallType CallType) { MemberInfo mi; iEvalTypedValue var; mi = GetMemberInfo(baseType, funcName, parameters); if (mi != null) { switch (mi.MemberType) { case MemberTypes.Field: { if ((CallType & eCallType.field) == 0) { mTokenizer.RaiseError("Unexpected Field"); } break; } case MemberTypes.Method: { if ((CallType & eCallType.method) == 0) { mTokenizer.RaiseError("Unexpected Method"); } break; } case MemberTypes.Property: { if ((CallType & eCallType.property) == 0) { mTokenizer.RaiseError("Unexpected Property"); } break; } default: { mTokenizer.RaiseUnexpectedToken(mi.MemberType.ToString() + " members are not supported"); break; } } return(opCodeCallMethod.GetNew(mTokenizer, @base, mi, parameters)); } if (@base is iVariableBag) { iEvalTypedValue val = ((iVariableBag)@base).GetVariable(funcName); if (val != null) { return(new opCodeGetVariable(val)); } } return(null /* TODO Change to default(_) if this is not a reference type */); }
private bool EmitCallFunction(ref opCode valueLeft, string funcName, IList <iEvalTypedValue> parameters, eCallType CallType, bool ErrorIfNotFound) { opCode newOpcode = null; if (valueLeft == null) { object functions = null; foreach (var funcs in mEvaluator.mEnvironmentFunctionsList) { functions = funcs; while (functions != null) { newOpcode = GetLocalFunction(funcs, funcs.GetType(), funcName, parameters, CallType); if (newOpcode != null) { goto Foo; } if (funcs is iEvalFunctions) { functions = ((iEvalFunctions)funcs).InheritedFunctions(); } else { break; } } } } else { newOpcode = GetLocalFunction(valueLeft, valueLeft.SystemType, funcName, parameters, CallType); } Foo: if (newOpcode != null) { valueLeft = newOpcode; return(true); } else { if (ErrorIfNotFound) { mTokenizer.RaiseError("Variable or method " + funcName + " was not found"); } return(false); } }
//---------------------------------------------------------------------------------------- // QueueLength | Parameters : eCallType | Return : int //---------------------------------------------------------------------------------------- public int QueueLength(eCallType repType) { int queueLength = 0; //calculate the length of the queue of the queue that represent the call type that matche eCallTpe switch (repType) { case eCallType.StereoCall: queueLength = ComputeQueueLength(StereoQueue); break; case eCallType.OtherCall: queueLength = ComputeQueueLength(OtherQueue); break; } //Return the queues length return queueLength; }
//---------------------------------------------------------------------------------------- // Calculate Processing Time Method | Parameter : eCallType //---------------------------------------------------------------------------------------- private double CalculateProcessingTime(eCallType entityCallType) { double processingInterval = 0; //compute the processing interval which is calculated difrently dependant on the call type switch (entityCallType) { case eCallType.StereoCall: processingInterval = (theDice.diceRoll() * GlobalParameters.CAR_STEREO_CALL_PROCESSING_TIME) * GlobalParameters.SEC_IN_MIN; break; case eCallType.OtherCall: processingInterval = (theDice.diceRoll() * GlobalParameters.OTHER_PRODUCT_CALL_PROCESSING_TIME) * GlobalParameters.SEC_IN_MIN; break; } //take the simulation time and add the tprocessing interval to get the time it will take to process double processingTime = SimulationTime + processingInterval; //return the time to process return processingTime; }
//--------------------------------------------------------------------------------------------- // Number of Busy reps | Parameters : eCallType | Return : int //--------------------------------------------------------------------------------------------- public int NumberOfBusyReps(eCallType theCallType) { int numBusy = 0; //switch to compute number of busy reps on the reps list corresponding to the call type passed in switch (theCallType) { case eCallType.OtherCall: numBusy = ComputeBusyCalls(OtherSalesReps); break; case eCallType.StereoCall: numBusy = ComputeBusyCalls(StereoSalesReps); break; } //Return the number of reps busy return numBusy; }
//--------------------------------------------------------------------------------- //Number Of Rep | Parameters : eCallType | Returns : int //---------------------------------------------------------------------------------- public int NumberOfReps(eCallType theCallType) { int count = 0; //switch to assign a rep depending on the call type passed in using the GetFreeRep method switch (theCallType) { case eCallType.OtherCall: count = ComputeNumberOfReps(OtherSalesReps); break; case eCallType.StereoCall: count = ComputeNumberOfReps(StereoSalesReps); break; } //returns the rep return count; }