Changeset 184:4d06074bb1af
- Timestamp:
- 03/10/08 11:49:04
(10 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
sync with dwt-linux
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r179 |
r184 |
|
| 186 | 186 | */ |
|---|
| 187 | 187 | public this (int numerator, int denominator, int offset) { |
|---|
| 188 | | if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); |
|---|
| | 188 | if (denominator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); |
|---|
| 189 | 189 | this.numerator = numerator; |
|---|
| 190 | 190 | this.denominator = denominator; |
|---|
| … | … | |
| 245 | 245 | n = temp; |
|---|
| 246 | 246 | } |
|---|
| 247 | | while (n !is 0){ |
|---|
| | 247 | while (n != 0){ |
|---|
| 248 | 248 | temp = m; |
|---|
| 249 | 249 | m = n; |
|---|
| … | … | |
| 284 | 284 | |
|---|
| 285 | 285 | int solveX (int value) { |
|---|
| 286 | | if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); |
|---|
| | 286 | if (denominator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); |
|---|
| 287 | 287 | return ((numerator * value) / denominator) + offset; |
|---|
| 288 | 288 | } |
|---|
| 289 | 289 | |
|---|
| 290 | 290 | int solveY (int value) { |
|---|
| 291 | | if (numerator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); |
|---|
| | 291 | if (numerator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO); |
|---|
| 292 | 292 | return (value - offset) * denominator / numerator; |
|---|
| 293 | 293 | } |
|---|
| … | … | |
| 299 | 299 | * @return a string representation of the FormAttachment |
|---|
| 300 | 300 | */ |
|---|
| 301 | | public override char[] toString () { |
|---|
| 302 | | char[] string = control !is null ? control.toString () : Format( "{}/{}", numerator, denominator ); |
|---|
| | 301 | override public char[] toString () { |
|---|
| | 302 | char[] string = control != null ? control.toString () : Format( "{}/{}", numerator, denominator ); |
|---|
| 303 | 303 | return Format("{{y = ({})x + {}}", string, ( offset >= 0 ? Format(")x + {}", offset ) : Format( ")x - {}", -offset))); |
|---|
| 304 | 304 | } |
|---|