1 package com.sharkysoft.printf; 2 3 import com.sharkysoft.printf.engine.IntegerFormatter; 4 import com.sharkysoft.printf.engine.RealFormatter; 5 6 class Formatter_e extends Formatter_Real 7 { 8 9 Formatter_e(final FormatSpecifier ipPfs) 10 { 11 super(ipPfs); 12 final IntegerFormatter ef = ((RealFormatter) mpFormatter).getExponentFormatter(); 13 switch (ipPfs.mcType) 14 { 15 case FormatSpecifier.TYPE_FLOAT_E_LOWER : 16 case FormatSpecifier.TYPE_FLOAT_G_LOWER : 17 ef.setNegPrefix("e-"); 18 ef.setZeroPrefix("e+"); 19 ef.setPosPrefix("e+"); 20 break; 21 case FormatSpecifier.TYPE_FLOAT_E_UPPER : 22 case FormatSpecifier.TYPE_FLOAT_G_UPPER : 23 ef.setZeroPrefix("E+"); 24 } 25 26 } 27 28 void format(final PrintfState ipPs) 29 { 30 adjustWidthAndPrecision(ipPs); 31 formatFloatScientific(ipPs); 32 } 33 34 } 35