sortlist.m

来自「仿真人工金融市场Jackson代码」· M 代码 · 共 70 行

M
70
字号
//  SortList.m//  This file defines the methods for working with a sorted list.  It is//    specially designed for a clearing info object at this point.//#import "SortList.h"// Implementation of a Sorted list object@implementation SortList +create: aZone {  list = [List create: [self getZone]];  return self;}-addAscend: (id) c {  ClearingInfo *aClearInfo;  id index;  if ([list getCount] != 0 ) {    index = [(id) list begin: scratchZone];    while ((aClearInfo = [index next])) {      // if <= then add in front      if ([c getPricePoint] <= [aClearInfo getPricePoint]) {        [index addBefore: c];        break;      }    }    [index drop];    // if we got to the end of the list, index will be    //   nil, but the trader won't be on teh list    if (aClearInfo == nil)      [list addLast: c];   } else  // this is the first      [list addLast: c];        return self;}-print {  printf ("NOT YET IMPLEMENTED.\n");  return self;}#if 0-begin: (id) aZone {  return  [list begin: aZone];}-getCount {  return ((int) [list getCount]);}-deleteAll {  [list deleteAll];  return self;}#endif@end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?