Skip to content

Commit

Permalink
NumericType interf: getNbits() instead of is*bits().
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomo-boldini committed Jan 17, 2024
1 parent 2b69ffc commit 1e8bf79
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} yields
* {@code false} and {@link #is32Bits()} yields {@code true}. An instance of
* {@code false} and {@link #getNbits()} yields {@code 32}. An instance of
* Float32 is assumed to be assignable to any {@link NumericType}, with possible
* loss of information. <br>
* <br>
Expand All @@ -24,7 +24,7 @@
* <br>
* Equality with other types is determined through
* {@link NumericType#sameNumericTypes(NumericType)}.
*
*
* @author <a href="mailto:[email protected]">Luca Negrini</a>
*/
public class Float32Type implements NumericType {
Expand All @@ -43,23 +43,8 @@ protected Float32Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return true;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 32;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} yields
* {@code false} and {@link #is64Bits()} yields {@code true}. An instance of
* {@code false} and {@link #getNbits()} yields {@code 64}. An instance of
* Float64 is assumed to be assignable to any {@link NumericType}, with possible
* loss of information. <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected Float64Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return true;
public int getNbits() {
return 64;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is16Bits()} yield {@code true}. An instance of Int16 is assumed to be
* {@link #getNbits()} yields {@code 16}. An instance of Int16 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected Int16Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return true;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 16;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is32Bits()} yield {@code true}. An instance of Int32 is assumed to be
* {@link #getNbits()} yields {@code 32}. An instance of Int32 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected Int32Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return true;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 32;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is64Bits()} yield {@code true}. An instance of Int64 is assumed to be
* {@link #getNbits()} yields {@code 64}. An instance of Int64 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected Int64Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return true;
public int getNbits() {
return 64;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is8Bits()} yield {@code true}. An instance of Int8 is assumed to be
* {@link #getNbits()} yields {@code 8}. An instance of Int8 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected Int8Type() {
}

@Override
public boolean is8Bits() {
return true;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is16Bits()} yield {@code true}. An instance of Int16 is assumed to be
* {@link #getNbits()} yields {@code 16}. An instance of Int16 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected UInt16Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return true;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 16;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is32Bits()} yield {@code true}. An instance of Int32 is assumed to be
* {@link #getNbits()} yields {@code 32}. An instance of Int32 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected UInt32Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return true;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 32;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is64Bits()} yield {@code true}. An instance of Int64 is assumed to be
* {@link #getNbits()} yields {@code 64}. An instance of Int64 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected UInt64Type() {
}

@Override
public boolean is8Bits() {
return false;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return true;
public int getNbits() {
return 64;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <br>
* Instances of this class are equal to all other classes that implement the
* {@link NumericType} interface, and for which {@link #isIntegral()} and
* {@link #is8Bits()} yield {@code true}. An instance of Int8 is assumed to be
* {@link #getNbits()} yields {@code 8}. An instance of Int8 is assumed to be
* assignable to any {@link NumericType}, with possible loss of information.
* <br>
* <br>
Expand Down Expand Up @@ -43,23 +43,8 @@ protected UInt8Type() {
}

@Override
public boolean is8Bits() {
return true;
}

@Override
public boolean is16Bits() {
return false;
}

@Override
public boolean is32Bits() {
return false;
}

@Override
public boolean is64Bits() {
return false;
public int getNbits() {
return 8;
}

@Override
Expand Down
Loading

0 comments on commit 1e8bf79

Please sign in to comment.