| 1 | (******************************************************************************* |
|---|
| 2 | Copyright 2009 Sun Microsystems, Inc., |
|---|
| 3 | 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 | All rights reserved. |
|---|
| 5 | |
|---|
| 6 | U.S. Government Rights - Commercial software. |
|---|
| 7 | Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 | license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 | |
|---|
| 10 | Use is subject to license terms. |
|---|
| 11 | |
|---|
| 12 | This distribution may include materials developed by third parties. |
|---|
| 13 | |
|---|
| 14 | Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 | trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 | ******************************************************************************) |
|---|
| 17 | |
|---|
| 18 | component conditionalExtension |
|---|
| 19 | |
|---|
| 20 | export Executable |
|---|
| 21 | |
|---|
| 22 | trait PartialOrderAndBoundedLattice[\T, opr LEOPR, opr MINOPR, opr MAXOPR\] end |
|---|
| 23 | trait Identity[\opr PLUS\] end |
|---|
| 24 | |
|---|
| 25 | trait RationalQuantity[\unit U absorbs unit, bool ninf, bool lt, bool eq, |
|---|
| 26 | bool gt, bool pinf, bool nan\] |
|---|
| 27 | extends { |
|---|
| 28 | RationalQuantity[\U, ninf', lt', eq', gt', pinf', nan'\] |
|---|
| 29 | where [\bool ninf', bool lt', bool eq', bool gt', bool pinf', |
|---|
| 30 | bool nan' \] |
|---|
| 31 | { ninf IMPLIES ninf', lt IMPLIES lt', |
|---|
| 32 | eq IMPLIES eq', gt IMPLIES gt', pinf IMPLIES pinf', |
|---|
| 33 | nan IMPLIES nan' |
|---|
| 34 | }, |
|---|
| 35 | PartialOrderAndBoundedLattice[\RationalQuantity[\U, ninf, lt, eq, gt, pinf, nan\], <=, MIN, MAX\] |
|---|
| 36 | where { ninf AND pinf AND NOT nan } |
|---|
| 37 | } |
|---|
| 38 | where { ninf OR lt OR eq OR gt OR pinf OR nan } |
|---|
| 39 | coerce(x: Identity[\+\]) = 0 |
|---|
| 40 | end |
|---|
| 41 | |
|---|
| 42 | run() = println "Conditional extension with where clauses can be parsed." |
|---|
| 43 | |
|---|
| 44 | end |
|---|