Created
May 28, 2011 16:35
-
-
Save kijuky/997015 to your computer and use it in GitHub Desktop.
Amountの単項マイナス演算子のテスト(要JScience)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jscience.physics.amount.* | |
def a = Amount.valueOf("1 m") | |
def b = Amount.valueOf("2 m") | |
Amount.metaClass.negative { | |
opposite() | |
} | |
def c = a + -b | |
assert c == Amount.valueOf("-1 m") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JScience - http://jscience.org/
http://www.java2s.com/Code/Jar/JKL/Downloadjsciencejar.htm