本文整理汇总了C#中System.Collections.Queue.Except方法的典型用法代码示例。如果您正苦于以下问题:C# Queue.Except方法的具体用法?C# Queue.Except怎么用?C# Queue.Except使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Queue
的用法示例。
在下文中一共展示了Queue.Except方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LOOK
public static Queue<Request> LOOK(Queue<Request> requestQueue, Drive.Stats driveStatistics)
{
if (requestQueue.Count <= 1)
return new Queue<Request>(requestQueue);
Func<int, int, bool> comparisonFunc = driveStatistics.HeadDirectionFlag ? (Func<int, int, bool>)((a,b) => a > b) : ((a, b) => a < b);
var requestsInDirectPath =
requestQueue.Where(request => comparisonFunc(request.Track, driveStatistics.TrackPosition));
var requestsInOppositePath = requestQueue.Except(requestsInDirectPath);
requestsInDirectPath=
requestsInDirectPath.OrderBy(
request => Utilities.RequestDistance(request, driveStatistics));
requestsInOppositePath= requestsInOppositePath.OrderBy(request => Utilities.RequestDistance(request,(requestsInDirectPath.Count() == 0) ? new Request(0,(driveStatistics.HeadDirectionFlag) ? driveStatistics.TracksPerFace : 0, 0) : requestsInDirectPath.Last(), driveStatistics));
return new Queue<Request>(requestsInDirectPath.Concat(requestsInOppositePath));
}
示例2: CLOOK
public static Queue<Request> CLOOK(Queue<Request> requestQueue, Drive.Stats driveStatistics)
{
if (requestQueue.Count <= 1)
return new Queue<Request>(requestQueue);
var requestsAbove =
requestQueue.Where(
request =>
request.Track > driveStatistics.TrackPosition && request.Sector > driveStatistics.SectorPosition);
var requestsBelow = requestQueue.Except(requestsAbove);
return
new Queue<Request>(requestsAbove.OrderBy(request => Utilities.RequestDistance(request, driveStatistics))
.Concat(
requestsBelow.OrderBy(
request => Utilities.RequestDistance(request.Track, 0, request.Sector, 0, driveStatistics))));
}