Atitit. . 软件命名空间与类名命名单词的统计程序设计v2

1. 要实现的目标1

1.1. Camel字符串模式的分词处理1

1.2. 多个大写的处理1

1.3. 数字与字幕的分离1

1.4. 其他/-_*.$斜杠中画线下划线性好点号美元字符字符的拆分1

1.5. 大写小写的合并2

1.6. 单数复数的合并2

1.7. 过滤数字及单个的字母2

1.8. 复数排除单词比如access,class2

1.9. 类要截取主类名,去除路径与扩展名2

2. Code----2

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的更多相关文章

  1. Atitit.软件命名空间  包的命名统计 及命名表(2000个名称) 方案java package

    Atitit.软件命名空间  包的命名统计 及命名表(2000个名称) 方案java package 1. 统计的lib jar 列表1 2. Code3 3. 常用包名按找字母排序(2000个)4 ...

  2. Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范

    Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范 简化英文1 常用类库sdk的命名单词统计表1 简化时间规则1 Namsspace nam spec,参照java . ...

  3. Atitit. 软件设计 模式 变量 方法 命名最佳实践 vp820 attilax总结命名表大全

    Atitit. 软件设计 模式 变量 方法 命名最佳实践 vp820 attilax总结命名表大全 1. #====提升抽象层次1 2. #----使用通用单词1 3. #===使用术语..1 4.  ...

  4. Atitit Atitit.软件兼容性原理----------API兼容 Qa7

    Atitit Atitit.软件兼容性原理----------API兼容 Qa7 1. 兼容性的重要性与反面教材1 2. 提升兼容性的原则2 2.1. What 与how 分离2 2.2. 老人老办法 ...

  5. Atitit.软件兼容性原理与实践 v5 qa2.docx

    Atitit.软件兼容性原理与实践   v5 qa2.docx 1. Keyword2 2. 提升兼容性的原则2 2.1. What 与how 分离2 2.2. 老人老办法,新人新办法,只新增,少修改 ...

  6. Atitit xml命名空间机制

    Atitit xml命名空间机制 命名冲突1 使用前缀来避免命名冲突2 使用命名空间(Namespaces)2 XML Namespace (xmlns) 属性2 默认的命名空间(Default Na ...

  7. Atitit.软件按钮与仪表盘(13)--全文索引操作--db数据库子系统mssql2008

    Atitit.软件按钮与仪表盘(13)--全文索引操作--db数据库子系统mssql2008 全文索引操作 4.全文索引和like语句比较 1 5.倒排索引 inverted index 1 2.SQ ...

  8. Atitit.软件button和仪表板(13)--全文索引操作--db数据库子系统mssql2008

    Atitit.软件button和仪表板(13)--全文索引操作--db数据库子系统mssql2008 全文索引操作 4.全文索引和like语句比較 1 5.倒排索引 inverted index 1 ...

  9. Atitit.软件开发的三层结构isv金字塔模型

    Atitit.软件开发的三层结构isv金字塔模型 第一层,Implements 层,着重与功能的实现.. 第二次,spec层,理论层,设计规范,接口,等.流程.方法论 顶层,val层,价值观层,原则, ...

随机推荐

  1. centos7下配置samba,win10访问

    yum install -y samba samba-client 更改配置 [root@abcd mnt]# cat /etc/samba/smb.conf [global] workgroup = ...

  2. ( 转 ) Mysql group_concat 的反向应用实现(Mysql列转行)

    用过Mysql的都知道她有一个很好的实现行转列功能的函数group_concat函数,非常方便 点击(此处)折叠或打开 SELECT * FROM group_test; SELECT id, GRO ...

  3. Exercise02_01

    import java.util.Scanner; public class Out { public static void main(String[] args){ Scanner input = ...

  4. 由SequenceFile.Writer(key,value)谈toString()方法

    之前有篇博客(http://www.cnblogs.com/lz3018/p/5243503.html)介绍以SequenceFile作为输入源进行矩阵乘法的过程,首先是将矩阵存储到SequenceF ...

  5. Spring使用ComponentScan扫描Maven多模块工程的其它模块

    说明:在新建好了Maven多模块工程后,如果想要在其它模块也能使用Spring的对象管理,比如@Autowrited这些注入方式,那么就必须开启包扫描的功能才能使其进行注入到Spring的对象管理中. ...

  6. [测试技术分享]easyFuzzer使用案例分享

    easyFuzzer使用案例分享 1.简介: easyFuzzer是wooyun的一位白帽子(光刃)提供的一款用于fuzz文件的工具.平时主要是和网络协议安全打交道,和本地软件安全打交道比较少,所以没 ...

  7. Getting terminal width in C?

    转:http://stackoverflow.com/questions/1022957/getting-terminal-width-in-c 方法一: #include <sys/ioctl ...

  8. Debian6 安装Kscope(也适用于Ubuntu)

    参考:http://soft.chinabyte.com/os/134/12307634.shtml kscope1.6.2在这里下载,下载后解压出kscope-1.6.2.tar.gz. 在ubun ...

  9. mac 安装PyQt5

    PyQt5官方安装教程指出2种安装方法: Installing from Wheels Building and Installing from Source 网上搜罗的大多是按照第二种方法安装的,本 ...

  10. js调试方法

    参考:1.https://developers.google.com/web/tools/chrome-devtools/javascript/ 2.https://developers.google ...