博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Atitit. . 软件命名空间与类名命名单词的统计程序设计v2
阅读量:4568 次
发布时间:2019-06-08

本文共 3315 字,大约阅读时间需要 11 分钟。

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. 复数排除单词比如accessclass2

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

2Code----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. 复数排除单词比如accessclass

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

 

 作者:: 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/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 strPaththrows 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,Maptab=new  HashMap<String, Map>();

public Map travePkgCalcNames(String strPath)

{

//final List<Map> m=new ArrayList<Map>();

//trav  jar file

new dirx().traveFile_noIncDir(strPathnew Closure () {

 

@Override

public Object execute(Object arg0throws Exception {

String jar=(String) arg0;

if(!jar.toLowerCase().endsWith("jar"))

return jar;//continue

JarFileView jfv=new JarFileView(jar);

jfv.travePkg(jarjar_file_trave_executor);

return null;

}

 

 

});

return tab;

}

 

 

final Closure jar_file_trave_executor=new Closure () {

 

@Override

public Object execute(Object arg0throws 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(nam2extMultiTrimWords).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;

}

};

转载于:https://www.cnblogs.com/attilax/p/5963579.html

你可能感兴趣的文章
shell中的declare命令
查看>>
SQL Server— 存在检测、建库、 建表、约束、外键、级联删除
查看>>
堆——数据结构
查看>>
CSS3特效----制作立体导航栏菜单
查看>>
性能测试应用领域
查看>>
JAVA 主要特性
查看>>
DataBase First创建数据库
查看>>
NSString和NSMutableNSString的基本用法
查看>>
Selenium_WebDriver_定位元素
查看>>
spring 的redis操作类RedisTemplate
查看>>
第三篇——软件工程之结构化设计方法
查看>>
文件上传和下载
查看>>
存储过程/存储函数
查看>>
C++ && C# 函数的递归调用
查看>>
Json-lib 进行java与json字符串转换之一
查看>>
c++基础知识学习-----数据程序的储存、表示形式和基本运算
查看>>
python cookbook读书笔记1 第一章 数据结构和算法1
查看>>
【bzoj4300】绝世好题 dp
查看>>
真事儿!——我们官网被全站拷贝了!
查看>>
边工作边刷题:70天一遍leetcode: day 27-1
查看>>