Atitit. . 软件命名空间与类名命名单词的统计程序设计v2
Atitit. . 软件命名空间与类名命名单词的统计程序设计v2
1.4. 其他/-_*.$斜杠中画线下划线性好点号美元字符字符的拆分1
2.1. public class NamespaceUtil {3
1. 要实现的目标
1.1. Camel字符串模式的分词处理
1.2. 多个大写的处理
最后一个大写与后边相连
1.3. 数字与字幕的分离
1.4. 其他/-_*.$斜杠中画线下划线性好点号美元字符字符的拆分
1.5. 大写小写的合并
1.6. 单数复数的合并
1.7. 过滤数字及单个的字母
1.8. 复数排除单词比如access,class
1.9. 类要截取主类名,去除路径与扩展名
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
2. Code----
package com.attilax.namespace;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import com.attilax.coll.ListX;
import com.attilax.collection.listUtil;
import com.attilax.io.dirx;
import com.attilax.io.filex;
import com.attilax.jar.JarFileView;
import com.attilax.json.JSONObject;
import com.attilax.lang.Closure;
import com.attilax.lang.MapX;
import com.attilax.lang.text.RegExpChar4splitor;
import com.attilax.lang.text.strUtil;
import com.attilax.office.excelUtil;
import com.attilax.text.CamelStrUtil;
import com.attilax.util.numUtil;
2.1. public class NamespaceUtil {
public static void main(String[] args) throws Exception {
//["com.attilax","camel","Gbnfm","hhh","comm"]
String s="com.attilax_camelXGbnfm-hhh/comm$123";
//s="CamelGbnfm";
List<String> li=toList_byDotByCase(s);
System.out.println( JSONObject.fromObject(li).toString(2));
String strPath = "D:\\workspace 空格\\AtiBrow\\lib";
//calcPkg(strPath);
calcCls(strPath);
System.out.println("--f");
}
private static void calcPkg(String strPath) throws Exception {
Map m=new NamespaceUtil().travePkgCalcNames(strPath);
List Li_table=listUtil.addAll(m);
System.out.println( com.attilax.json.JSONArray.fromObject(Li_table).toString(2));
excelUtil.toExcel("名字,计数", "name,count", Li_table, "c:\\calc_pkg_"+filex.getUUidName()+".xls");
}
final Map<String,Map> tab=new HashMap<String, Map>();
public Map travePkgCalcNames(String strPath)
{
//final List<Map> m=new ArrayList<Map>();
//trav jar file
new dirx().traveFile_noIncDir(strPath, new Closure () {
@Override
public Object execute(Object arg0) throws Exception {
String jar=(String) arg0;
if(!jar.toLowerCase().endsWith("jar"))
return jar;//continue
JarFileView jfv=new JarFileView(jar);
jfv.travePkg(jar, jar_file_trave_executor);
return null;
}
});
return tab;
}
final Closure jar_file_trave_executor=new Closure () {
@Override
public Object execute(Object arg0) throws Exception {
String pkg=arg0.toString();
if("META-INF/".toLowerCase().equals(pkg.toLowerCase()))
return null;
if(pkg.startsWith("META-INF"))return null;
pkg=pkg.replace("/", ".");
System.out.println(pkg);
List<String> nams=new ClassNameSplitor().split(pkg);
for ( String nam : nams) {
final String nam2=nam;
final String nam_key=strUtil.getSingleFmt(nam2, extMultiTrimWords).toLowerCase().trim();
if(filted(nam_key))
continue;
Map row=tab.get(nam_key);
if(row==null)
{
tab.put(nam_key,new HashMap (){{
this.put("name", nam_key);
this.put("count", 0);
}});//add new row
}
row=tab.get(nam_key);
//new HashMap<String,Integer>();
row.put( "count",MapX.get(row,"count",0)+1);
//m.putm.get(nam)
}
return null;
}
};
Atitit. . 软件命名空间与类名命名单词的统计程序设计v2的更多相关文章
- Atitit.软件命名空间 包的命名统计 及命名表(2000个名称) 方案java package
Atitit.软件命名空间 包的命名统计 及命名表(2000个名称) 方案java package 1. 统计的lib jar 列表1 2. Code3 3. 常用包名按找字母排序(2000个)4 ...
- Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范
Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范 简化英文1 常用类库sdk的命名单词统计表1 简化时间规则1 Namsspace nam spec,参照java . ...
- Atitit. 软件设计 模式 变量 方法 命名最佳实践 vp820 attilax总结命名表大全
Atitit. 软件设计 模式 变量 方法 命名最佳实践 vp820 attilax总结命名表大全 1. #====提升抽象层次1 2. #----使用通用单词1 3. #===使用术语..1 4. ...
- Atitit Atitit.软件兼容性原理----------API兼容 Qa7
Atitit Atitit.软件兼容性原理----------API兼容 Qa7 1. 兼容性的重要性与反面教材1 2. 提升兼容性的原则2 2.1. What 与how 分离2 2.2. 老人老办法 ...
- Atitit.软件兼容性原理与实践 v5 qa2.docx
Atitit.软件兼容性原理与实践 v5 qa2.docx 1. Keyword2 2. 提升兼容性的原则2 2.1. What 与how 分离2 2.2. 老人老办法,新人新办法,只新增,少修改 ...
- Atitit xml命名空间机制
Atitit xml命名空间机制 命名冲突1 使用前缀来避免命名冲突2 使用命名空间(Namespaces)2 XML Namespace (xmlns) 属性2 默认的命名空间(Default Na ...
- Atitit.软件按钮与仪表盘(13)--全文索引操作--db数据库子系统mssql2008
Atitit.软件按钮与仪表盘(13)--全文索引操作--db数据库子系统mssql2008 全文索引操作 4.全文索引和like语句比较 1 5.倒排索引 inverted index 1 2.SQ ...
- Atitit.软件button和仪表板(13)--全文索引操作--db数据库子系统mssql2008
Atitit.软件button和仪表板(13)--全文索引操作--db数据库子系统mssql2008 全文索引操作 4.全文索引和like语句比較 1 5.倒排索引 inverted index 1 ...
- Atitit.软件开发的三层结构isv金字塔模型
Atitit.软件开发的三层结构isv金字塔模型 第一层,Implements 层,着重与功能的实现.. 第二次,spec层,理论层,设计规范,接口,等.流程.方法论 顶层,val层,价值观层,原则, ...
随机推荐
- 19、Flask实战第19天:CSRF攻击与防御
CSRF攻击原理 网站是通过cookie来实现登录功能的.而cookie只要存在浏览器中,那么浏览器在访问这个cookie的服务器的时候,就会自动的携带cookie信息到服务器上去.那么这时候就存在一 ...
- 1.1(Spring MVC学习笔记)初识SpringMVC及SpringMVC流程
一.Spring MVC Spring MVC是Spring提供的一个实现了web MVC设计模式的轻量级Web框架. Spring优点:网上有,此处不复述. 二.第一个Spring MVC 2.1首 ...
- 使用DFS求任意两点的所有路径
先上代码: public static void findAllPaths(Integer nodeId,Integer targetNodeId, Map<Integer,ArrayList& ...
- java static代码段
1)java中还有个static代码块的形式,形式为 static {……}.static代码块是类定义的一部分,仅仅在类被初次加载的时候被调用一次,之后再调用不会再加载.那么类什么时候首次被加载呢? ...
- Java高级架构师(一)第09节课:搭建基础的开发环境
- AngularJS的加载执行过程
1. HTML页面的加载,这会触发加载页面包含的所有JS (包括 AngularJS) 2. AngularJS启动,搜寻所有的指令(directive) 3. 找到ng-app,搜寻其指定的模块(M ...
- Visual Studio 断点无法命中怎么办?
经常远程调试服务器打断点是空心的,很抓狂,正确的方法应该是 #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { System.Diagnos ...
- MySQL第三方客户端工具
如前所述,MySQL是一个基于客户机--服务器的DBMS,因此,为了使用MySQl,你需要有一个客户机软件给MySQL提供要执行的命令.即你需要一个编写和测试MySQL脚本的工具. 1.MySQL命令 ...
- mongodb_profier
http://docs.mongodb.org/manual/reference/database-profiler/ 一.获取.设置profile(profile用collection存储数据) d ...
- 关于spring-data-jpa的排序问题
本测试基于springBoot框架实现. pom.xml文件: <project xmlns="http://maven.apache.org/POM/4.0.0" xmln ...