1 package com.ljs.ootp.extract.html.rating; 2 3 /** 4 * 5 * @author lstephen 6 */ 7 public abstract class IntegerScale implements Scale<Integer> { 8 9 @Override 10 public Rating<Integer, IntegerScale> parse(String s) { 11 return Rating.create(Integer.parseInt(s), this); 12 } 13 14 @Override 15 public Rating<Integer, OneToOneHundred> normalize(Integer value) { 16 return OneToOneHundred.valueOf(scale(value)); 17 } 18 19 protected abstract Integer scale(Integer value); 20 21 }