Changeset 2739 for trunk/Library/FortressLibrary.fss
- Timestamp:
- 08/25/08 07:23:17 (15 months ago)
- Files:
-
- 1 modified
-
trunk/Library/FortressLibrary.fss (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Library/FortressLibrary.fss
r2715 r2739 135 135 isLeftZero(_:Comparison): Boolean = true 136 136 end 137 138 opr BIG LEXICO(): BigReduction[\TotalComparison, TotalComparison\] = 139 BigReduction[\TotalComparison,TotalComparison\](LexicographicReduction) 140 137 141 138 142 trait Comparison … … 1100 1104 trait Condition[\E\] extends { ZeroIndexed[\E\], SequentialGenerator[\E\] } 1101 1105 getter isEmpty(): Boolean = NOT holds() 1106 getter nonEmpty(): Boolean = NOT isEmpty() 1102 1107 getter holds(): Boolean = cond[\Boolean\](fn (_:E):Boolean => true, fn () => false) 1103 1108 getter size(): ZZ32 = if holds() then 1 else 0 end … … 1453 1458 defined as size=0 *) 1454 1459 getter isEmpty(): Boolean = |self| = 0 1455 (** %size()% is depracated; use %|self|%. *) 1460 getter nonEmpty(): Boolean = NOT self.isEmpty 1461 (** %self.size% is equivalent to %|self|%. *) 1456 1462 getter size(): ZZ32 1457 1463 (** bounds() yields a range of indices that are valid for the … … 3027 3033 RangeWithExtent[\T\], PartialRange[\T\] } 3028 3034 excludes { Number } 3029 getter isEmpty(): Boolean = (|self| ≤ 0)3035 3030 3036 opr[r:Range[\T\]]: Range[\T\] = fail("Unrecognized Range " r) 3031 3037 opr[_:OpenRange[\Any\]] : Range[\T\] = self … … 3284 3290 self.lower#r.extent 3285 3291 else 3286 fail(self "[" r "] is not sufficiently largein some dimension")3292 fail(self "[" r "] is too small in some dimension") 3287 3293 end 3288 3294 opr[r:CompleteRange[\T\]]: CompleteRange[\T\] = … … 3303 3309 3304 3310 opr =(self, other:CompleteRange[\T\]): Boolean = 3305 self.isBounded=other.isBounded AND self.lower=other.lower AND 3306 self.extent = other.extent 3311 (* isBounded()=other.isBounded() AND 3312 APB 2008.08.20: this seems bogus: isBounded tells us only whether we were created 3313 using an extent or an upper bound, and should not effect the comparison *) 3314 lower()=other.lower() AND extent() = other.extent() 3315 3307 3316 opr CMP(self, other:Range[\T\]): Comparison = 3308 3317 typecase other of … … 3315 3324 (LessThan,LessThan) => Unordered 3316 3325 (GreaterThan,GreaterThan) => Unordered 3317 (EqualTo,EqualTo) => 3326 (* This case seems unncessary; the (EqualTo,Comparison) case will cover us --- APB 2008.08.20 3327 (EqualTo,EqualTo) => EqualTo 3318 3328 if self.isBounded = other.isBounded then 3319 3329 EqualTo … … 3321 3331 Unordered 3322 3332 end 3333 *) 3323 3334 (EqualTo,Comparison) => b 3324 3335 (GreaterThan,Comparison) => LessThan … … 3676 3687 3677 3688 opr |self| : ZZ32 = self.size 3678 opr CASE_INSENSITIVE_CMP(self, other:String): TotalComparison 3679 (** As a convenience, we permit LowerRange indexing to go 1 past the bounds 3689 3690 opr CASE_INSENSITIVE_CMP(self, other:String): TotalComparison = 3691 ((BIG LEXICO[i <- 0#(|self| MIN |other|) ] self.get(i) CASE_INSENSITIVE_CMP other.get(i)) LEXICO (|self| CMP |other|)) 3692 3693 opr CMP(self, other:String): TotalComparison = 3694 ((BIG LEXICO[i <- 0#(|self| MIN |other|) ] self.get(i) CMP other.get(i)) LEXICO (|self| CMP |other|)) 3695 3696 opr [i:ZZ32]: Char = 3697 (** As a convenience, we permit LowerRange indexing to go 1 past the bounds 3680 3698 of the String, returning the empty String, in order to permit some convenient 3681 3699 String-trimming idioms. **) 3682 opr [i:ZZ32]: Char =3683 3700 if 0 <= i < |self| 3684 3701 then self.get(i) … … 3773 3790 3774 3791 3775 print(a:Any):() = print( "" a)3776 println(a:Any):() = println( "" a)3792 print(a:Any):() = print(a.toString) 3793 println(a:Any):() = println(a.toString) 3777 3794 (* 0-argument versions handle passing of () to single-argument versions. *) 3778 3795 print():() = print("") … … 3782 3799 println(a: JavaString): () = 3783 3800 builtinPrimitive("com.sun.fortress.interpreter.glue.prim.StringPrim$Println") 3784 3785 3801 3786 3802 forDigit(x:ZZ32, radix:ZZ32): Maybe[\Char\] =

