public string HandleRequest(int data) {
     if (data < structure[level].Limit) {
         return "Request for " +data+" handled by "+level+ " "+id;
     }
     else if (level > First) {
         Levels nextLevel = --level;
         int which = choice.Next(structure[nextLevel].Positions);
         return handlersAtLevel[nextLevel][which].HandleRequest(data);
     }
     else {
         Exception chainException = new ChainException(  );
         chainException.Data.Add("Limit", data);
         throw chainException;
     }
 }
 public string HandleRequest(int data)
 {
     if (data < Limit)
     {
         return("Request for " + data + " handled at level " + id);
     }
     else if (next != null)
     {
         return(next.HandleRequest(data));
     }
     else
     {
         Exception chainException = new ChainException();
         chainException.Data.Add("Limit", data);
         throw chainException;
     }
 }
Beispiel #3
0
 public string HandleRequest(int data)
 {
     if (data < structure[level].Limit)
     {
         return("Request of this " + data + " can be handled by " + level + " " + id);
     }
     else if (level > First)
     {
         Levels nextLevel = --level;
         int    which     = choice.Next(structure[nextLevel].Positions);
         return(handlersAtLevel[nextLevel][which].HandleRequest(data));
     }
     else
     {
         Exception chainException = new ChainException();
         chainException.Data.Add("Limit", data);
         throw chainException;
     }
 }
            public string HandleRequest(int data)
            {
                int currLimit = (int)level;

                if (data < currLimit)
                {
                    return("Request for " + data + " handled by " + level + " " + id);
                }
                else if (level < First)
                {
                    Levels nextLevel = level.Next <Levels>();
                    int    which     = choice.Next(structure[nextLevel].Positions);
                    return(handlersAtLevel[nextLevel][which].HandleRequest(data));
                }
                else
                {
                    Exception chainException = new ChainException();
                    chainException.Data.Add("Limit", data);
                    throw chainException;
                }
            }
Beispiel #5
0
 public ChainExceptionEvent(IReadOnlyChainContext context, ChainException exception)
 {
     Context   = context;
     Exception = exception;
 }