home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / samples.z / StringLengthSort.wxc < prev    next >
Text File  |  1997-01-28  |  2KB  |  78 lines

  1. Save Format v2.0(1)
  2. @begin ClassFile "StringLengthSort"
  3.  Exported 1;
  4.  Abstract 0;
  5.  Interface 0;
  6.  PackageName "";
  7.  Language "Java";
  8.  
  9.  @begin UserFunction "compare(Object a, Object b)"
  10.   GencodeSrcLine 11;
  11.   FunctionName "StringLengthSort::compare(Object a, Object b)";
  12.  @end;
  13.  
  14.  @begin UserFunction "Prototype for compare(Object a, Object b)"
  15.   Private 1;
  16.   GencodeSrcLine -1;
  17.   FunctionName "StringLengthSort::Prototype for compare(Object a, Object b)";
  18.  @end;
  19.  
  20.  @begin HPPPrefixBlock
  21. @begin-code HPPPrefix
  22.  
  23. // add your custom import statements here
  24. import powersoft.jcm.util.*;
  25.  
  26. @end-code;
  27.   GencodeSrcLine 6;
  28.  @end;
  29.  
  30.  @begin ClassContentsBlock
  31. @begin-code ClassContents
  32.  
  33.     // add your data members here
  34.  
  35. @end-code;
  36.   GencodeSrcLine 27;
  37.  @end;
  38.  
  39. @begin-code BaseClassList
  40.  
  41. extends Object implements CompareRoutine
  42.  
  43. @end-code;
  44.  
  45. @begin-code GeneratedClassContents
  46.  
  47.  
  48. @end-code;
  49.  
  50. @begin-code Code "StringLengthSort::compare(Object a, Object b)"
  51.  
  52. //****************************
  53. /*
  54.  * This class was created to implement a new compare
  55.  * routine for a SortableVector.
  56.  *
  57.  * compare method returns:
  58.  * a negative number if a < b
  59.  * zero              if a == b
  60.  * a positive number if a > b
  61. */
  62.  
  63.     public int compare(Object a, Object b)    
  64.     //****************************
  65.     {
  66.         return ((String)a).length() - ((String)b).length();
  67.     }
  68.  
  69. @end-code;
  70.  
  71. @begin-code Code "StringLengthSort::Prototype for compare(Object a, Object b)"
  72.  
  73.     public:
  74.         int compare(Object a, Object b);
  75.  
  76. @end-code;
  77. @end;
  78.