枚举的使用(限foton)
使用:
/**
* 服务真实性标签
*
* @param realRepairs
* 真实维修单数
* @param totalRepairs
* 总单数
* @return
*/
public static AuthenticityType getAuthenticityTag(int realRepairs, int totalRepairs) {
double rate = ArithUtil.div(realRepairs, totalRepairs);
if (rate >= 0.9) {
return AuthenticityType.TOP90;
} else if (rate >= 0.6) {
return AuthenticityType.TOP60;
} else {
return AuthenticityType.UNDER60;
}
} POJO public class ServicerProfile { private Long servicerId;
private String servicerCode;
private String servicerName; public enum AuthenticityType { TOP90(31, "优秀"), TOP60(32, "良好"), UNDER60(33, "不及格"); private final int value;
private final String description; private static final Map<Integer, AuthenticityType> valuesMap = Maps.newHashMap();
private static final Map<String, AuthenticityType> namesMap = Maps.newHashMap();
static {
for (AuthenticityType type : AuthenticityType.values()) {
valuesMap.put(type.getValue(), type);
namesMap.put(type.name(), type);
}
} private AuthenticityType(int value, String description) {
this.value = value;
this.description = description;
} public static AuthenticityType parse(Integer value) {
if (value == null) {
return null;
} return valuesMap.get(value);
} public static AuthenticityType parse(String name) {
if (name == null) {
return null;
} return namesMap.get(name);
} public Integer getValue() {
return value;
} public String getDescription() {
return description;
}
} }
枚举的使用(限foton)的更多相关文章
- 关于数据源为授权车辆、企业车辆的判断(限foton)
int mode = carInfoService.getCompanyCarMode(companyId); public int getCompanyCarMode(Long companyId) ...
- 对于类似经销商的实体中Place(CBM_PALCE_ID = NULL)的情况,如何获取省市信息(限foton)
在库里像上述描述的数据很多,这种情况需要拿fence里的经纬度,反查省市 String[] strArr = data.getFence().getValue().split(";" ...
- ServletUtils取值(限foton)
1.String query = ServletUtils.getStringValue(request, "query", null); 2.boolean reload = S ...
- 查询时间段内所有日期(限foton)
String dataStr = "2019-04"; try { Date date = DateUtils.parseDate(dataStr); Date startTime ...
- 【BZOJ-3532】Lis 最小割 + 退流
3532: [Sdoi2014]Lis Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 704 Solved: 264[Submit][Status] ...
- WCF Throttling 限流的三道闸口
WCF Throttling 限流的三道闸口 一.WCF Throttling 流量限制简介 我们期望WCF服务端能够处理尽可能多的并发请求,但是资源是有限的,服务不可能同时处理无限多的并发请求,如 ...
- C#基础(二)拆箱与装箱,循环与选择结构,枚举
一.装箱和拆箱 装箱是将值类型转换为引用类型 eg: Int a=5; Object o=a; 拆箱是将引用类型转换为值类型 eg: Int a=5; Object o=a; Int b=(int ...
- Python面向对象高级编程-__slots__、定制类,枚举
当在类体内定义好各种属性后,外部是可以随便添加属性的,Python中类如何限制实例的属性? Python自带了很多定制类,诸如__slots__,__str__ __slots__ __slots__ ...
- 关于IEnumerator<T>泛型枚举器 和 IEnumerable<T>
在开发中我们经常会用到 IEnumerable<T> xxx 或者 List<T> xxx 这种集合或者集合接口,实际上就是一个线性表嘛然后结合C#提供的语法糖 foreach ...
随机推荐
- Oracle学习(八)RECORD(自定义结构)
一.定义 记录数据类型的一种,将几个相关的.分离的.基本数据类型的变量组成一个类似于整体表结构的对象,即RECORD复合数据类型. 在使用记录数据类型变量时,需要在声明部分先定义记录的组成.记录的变量 ...
- RIP思维导图
- zookeeper 笔记--curator分布式锁
使用ZK实现分布式独占锁, 原理就是利用ZK同级节点的唯一性. Curator框架下的一些分布式锁工具InterProcessMutex:分布式可重入排它锁 InterProcessSemaphore ...
- Go-archive/tar: write after close gopher.txt
where? 在使用Go中tar包循环写入内容的时候 why? 因为已经关闭了tar.writer对象,所以无法写入,但是程序还是有写入操作,所以报错 way? 通过 defer关键字来管理资源的释放 ...
- Python编程学习第三课之编程从Hello World开始
在搞定了前几节课的情况下,大家是否有一种想要跃跃欲试的赶脚,接下来就是我们开始练手的实战时刻. 每个编程人员入门编程的第一课都是向我们马上要进入的编程世界问好,"你好,世界"英文说 ...
- 玩转Libmodbus(一) 搭建开发环境
这篇文章是转载的,我主要是参考了其搭建环境的部分. 转载自: https://blog.csdn.net/qq_40452910/article/details/88560310 一.源码下载 1.l ...
- Python-joypy和 R-ggridges 峰峦图制作
本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 以下文章来源于DataCharm,作者 宁海涛 转载地址 https://www ...
- 实验 2:Mininet 实验——拓扑的命令脚本生成
一.实验目的 掌握 Mininet 的自定义拓扑生成方法:命令行创建.Python 脚本编写 二.实验任务 通过使用命令行创建.Python 脚本编写生成拓扑,熟悉 Mininet 的基本功能. 三. ...
- CSS中居中的完全指南(中英对照翻译)
翻译自:https://css-tricks.com/centering-css-complete-guide/ Centering things in CSS is the poster child ...
- tu
1 第五章 图 2 //结构定义 3 #define MaxVertexNum 100 //图中顶点数目的最大值 4 typedef struct ArcNode{ //边表节点 5 int adjv ...