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. VS code 的变量设定

    文档来自https://code.visualstudio.com/docs/editor/variables-reference 预定义的变量有: ${workspaceFolder} - the ...

  2. Problem C: 零起点学算法18——3个数比较大小

    #include<stdio.h> int main() { int a,b,c; while(scanf("%d %d %d",&a,&b,& ...

  3. iOS开发经验——点击屏幕空白处退出键盘

          一种比较简单的点击屏幕空白处退出键盘的方法: 在ViewController中加入如下代码: 1: -(void)touchesBegan:(NSSet *)touches withEve ...

  4. ctags 小记

    转:http://www.cnblogs.com/napoleon_liu/archive/2011/01/23/1942738.html 简介 ctags − Generate tag files ...

  5. [Android 新特性] 谷歌发布Android Studio开发工具1.0正式版(组图) 2014-12-09 09:35:40

    Android Studio是谷歌于13年I/O大会推出的Android开发环境,基于IntelliJ IDEA. 类似 Eclipse ADT,Android Studio 提供了集成的Androi ...

  6. npm依赖管理:冗余,依赖树

    npm的依赖树查询:原理都是查询文件夹node_modules的结构.比如mac的node_modules位置在/usr/local/lib下.具体项目的node_modules位置位于项目根目录下. ...

  7. projecteuler----&gt;problem=11----Largest product in a grid

    In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 1 ...

  8. 常用vim命令合集

    移动命令: h:左移 l:右移 k:上移 j:下移 ^:移动到本行第一个非空白字符上 0:移动到本行第一个字符上 gg:移动到文件头 G = shift + g:移动到文件尾 %:从一个"{ ...

  9. nagios监控redis

    nagios是非常强大的监控工具,但是它本身没有监控redis的功能 但是网上有很多大神写了监控redis的插件,比较热门的使用perl写的check_redis.pl 但是由于我们监控mongodb ...

  10. 小二助手(react应用框架)-http访问

    浏览地址http://118.25.217.253:4000 账号test密码123   qq讨论群:836719189 要写这个系统,就需要数据来源,让我们先来看看如果通过客户端调用服务端api拿到 ...