爪哇的烹饪单位
是否有任何开源库可以用 Java 表示茶匙和汤匙等烹饪单位?
我只找到了 JSR-275 (https://jcp.org/en/jsr/详细信息?id=275)这很棒,但不了解烹饪装置。
Are there any open source libraries for representing cooking units such as Teaspoon and tablespoon in Java?
I have only found JSR-275 (https://jcp.org/en/jsr/detail?id=275) which is great but doesn't know about cooking units.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
JScience 是可扩展的,因此您应该能够创建 javax.measure.unit.SystemOfUnits 的子类。 您将创建许多公共静态最终声明,如下所示:
只要您知道转换系数是什么,定义其他单位和转换就非常简单。
JScience is extensible, so you should be able to create a subclass of javax.measure.unit.SystemOfUnits. You'll create a number of public static final declarations like this:
It's pretty straightforward to define the other units and conversions, just as long as you know what the conversion factors are.
这可能会有一些用处:JUnitConv。 它是一个用于转换单位(包括烹饪单位)的 Java 小程序,但它是 GPL 许可的,因此您可以下载源代码并调整相关部分以供您自己使用。
另一方面,看起来创建一个符合 JSR 275 的
CookingUnits
类应该不难。(这就是我要做的)This might be of some use: JUnitConv. It's a Java applet for converting units (including cooking units), but it's GPL-licensed so you could download the source and adapt the relevant parts for your own use.
On the other hand, it looks like it shouldn't be hard to create a
CookingUnits
class compliant with JSR 275. (That's what I'd do)恐怕,我们无法帮助您处理 JSR-275,因为它被拒绝了,但是 JSR-363 只是九月进入决赛,所以如果您对“烹饪单位”等单位系统有好主意,请在 UoM 系统。
I'm afraid, we can't help you with JSR-275 as it was rejected, but JSR-363 just went Final in September, so if you have a great idea for unit systems like "Cooking Units", please just let us know under UoM-Systems.
我想你可以解析维基页面以获取烹饪测量:烹饪重量和测量
它拥有所有度量以表格形式组织,因此解析它们应该很容易。
I guess you can parse the wiki page for cooking measurements: Cooking Weights and Measures
It has all the measures organized in tables, so it should be pretty easy to parse them out.