Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the units API #1684

Merged
merged 3 commits into from
Mar 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Angle.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Angle class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Angle(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Angle> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Angle> unit()
{
return unit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the ElectricPotential class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public ElectricPotential(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.ElectricPotential> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.ElectricPotential> unit()
{
return unit;
Expand Down
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Frequency.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Frequency class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Frequency(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Frequency> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Frequency> unit()
{
return unit;
Expand Down
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Length.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Length class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Length(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Length> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Length> unit()
{
return unit;
Expand Down
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Power.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Power class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Power(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Power> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Power> unit()
{
return unit;
Expand Down
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Pressure.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Pressure class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Pressure(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Pressure> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Pressure> unit()
{
return unit;
Expand Down
4 changes: 4 additions & 0 deletions components/ome-xml/src/ome/units/quantity/Quantity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

package ome.units.quantity;

import ome.units.unit.Unit;

/**
* A wrapper for the Quantity class from the units implimintation.
*
Expand All @@ -44,4 +46,6 @@
*/
public abstract class Quantity
{
public abstract Number value();
public abstract Unit<? extends Quantity> unit();
}
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Temperature.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Temperature class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Temperature(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Temperature> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Temperature> unit()
{
return unit;
Expand Down
5 changes: 3 additions & 2 deletions components/ome-xml/src/ome/units/quantity/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

package ome.units.quantity;

import ome.units.quantity.Quantity;
import ome.units.unit.Unit;
import ome.units.UNITS;

/**
* A wrapper for the Time class from the units implementation.
Expand Down Expand Up @@ -68,6 +66,7 @@ public Time(Number inValue,
hashCodeValue = SEED2 * hashCodeValue + unit.getSymbol().hashCode();
}

@Override
public Number value()
{
return value;
Expand All @@ -86,6 +85,7 @@ public Number value(Unit<ome.units.quantity.Time> inUnit)
return null;
}

@Override
public boolean equals(Object other)
{
if (other == null)
Expand Down Expand Up @@ -140,6 +140,7 @@ public String toString()
return result.toString();
}

@Override
public Unit<ome.units.quantity.Time> unit()
{
return unit;
Expand Down