Skip to content

Commit f324f1d

Browse files
committed
UNITSOFMEASUREMENT-183: getProductUnits should probably be renamed
Task-Url: https://java.net/jira/browse/UNITSOFMEASUREMENT-183
1 parent ab62832 commit f324f1d

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/main/java/javax/measure/Unit.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ public interface Unit<Q extends Quantity<Q>> {
131131
*
132132
* @return the base units and their exponent making up this unit.
133133
*/
134+
Map<? extends Unit<?>, Integer> getBaseUnits();
135+
136+
/**
137+
* @deprecated use #getBaseUnits instead
138+
*/
134139
Map<? extends Unit<?>, Integer> getProductUnits();
135140

136141
/**
@@ -338,7 +343,7 @@ public interface Unit<Q extends Quantity<Q>> {
338343
/**
339344
* <p>
340345
* Returns a string representation of this unit. The string representation may be the unit {@linkplain #getSymbol() symbol}, or may be some
341-
* representation of {@linkplain #getProductUnits() product units}, multiplication factor and offset if any.
346+
* representation of {@linkplain #getBaseUnits() product units}, multiplication factor and offset if any.
342347
* </p>
343348
* The string may be localized at implementation choice by the means of a particular device and platform. <br>
344349
*

src/test/java/javax/measure/test/EnumUnit.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Unit getSystemUnit() {
6666
return this;
6767
}
6868

69-
public Map getProductUnits() {
69+
public Map getBaseUnits() {
7070
// TODO Auto-generated method stub
7171
return null;
7272
}
@@ -141,4 +141,9 @@ public String getName() {
141141
return name();
142142
}
143143

144+
public Map getProductUnits() {
145+
// TODO Auto-generated method stub
146+
return null;
147+
}
148+
144149
}

src/test/java/javax/measure/test/TestUnit.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public String getName() {
136136
return name;
137137
}
138138

139-
public Map<Unit<?>, Integer> getProductUnits() {
139+
public Map<Unit<?>, Integer> getBaseUnits() {
140140
return null;
141141
}
142142

@@ -192,4 +192,8 @@ public double getMultFactor() {
192192
public String toString() {
193193
return getName();
194194
}
195+
196+
public Map getProductUnits() {
197+
throw new UnsupportedOperationException("Use getBaseUnits() instead");
198+
}
195199
}

0 commit comments

Comments
 (0)