lyyb2001

          只是為方便自己找記錄而已
          posts - 57, comments - 27, trackbacks - 0, articles - 5
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理

          2007年6月20日

          表單里面先對某一個控件有效性驗證(如手機號碼,當(dāng)手機號碼輸入正確,才發(fā)送驗證碼,最后才是對表單驗證)

          <input type="text" id="mobile" name="mobile" placeholder="請輸入您的手機號碼" class="easyui-validatebox form-control" data-options="required:true,validType:'mobile'" />

          validateType自己擴展規(guī)則

          對單個輸入框的驗證為:$("#mobile").validatebox('isValid') 通過返回true

          posted @ 2017-09-19 15:59 skycity 閱讀(840) | 評論 (0)編輯 收藏

              public enum Section {
          KITTING(1),
          LABELKITTING(2),
          PACKING(3);

          private final int code;

          private Section(int code)
          {
          this.code=code;
          }
          public int getCode()
          {
          return this.code;
          }
          }

          Map<Integer,Section> MAP=Arrays.stream(Section.values()).collect(Collectors.toMap(s->s.code, section->section));

          posted @ 2017-07-11 11:40 skycity 閱讀(2767) | 評論 (0)編輯 收藏

          Optional<MaterialPaneModel> maxMaterial = list.stream().max(Comparator.comparingInt(MaterialPaneModel::getMaterialQty));

          posted @ 2017-07-06 15:43 skycity 閱讀(4020) | 評論 (0)編輯 收藏

          try{

          JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();

          factoryBean.getInInterceptors().add(new LoggingInInterceptor());

          factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());

          factoryBean.setServiceClass(AutoPackServiceIntf.class);

          factoryBean.setAddress("http://10.241.0.105:17000/TEST");

          AutoPackServiceIntf factory = (AutoPackServiceIntf) factoryBean.create();

          Client client = ClientProxy.getClient(factory);

          HTTPConduit conduit = (HTTPConduit) client.getConduit();

          HTTPClientPolicy policy = new HTTPClientPolicy();

          policy.setConnectionTimeout(30000); //連接超時時間

          policy.setReceiveTimeout(120000); //請求超時時間.

          conduit.setClient(policy);

          System.out.println(factory.getFirstUnitCramp("1"));

          }catch(WebServiceException ex){

          long l2 = System.currentTimeMillis();

          System.out.println((l2-l1)+"ms");

          System.out.println("連接異常");

          }

          posted @ 2016-12-08 14:19 skycity 閱讀(297) | 評論 (0)編輯 收藏

          通過Application

          ApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext();

               classPath = classPathXmlApplicationContext.getResource("classpath:config.properties").getFile().getPath();

                  if(classPath.indexOf("WEB-INF")>0){

                      classPath = classPath.substring(0,classPath.indexOf("WEB-INF")+7)+"/classes/"+xmlFile;

                  }

           

          posted @ 2016-11-03 18:17 skycity 閱讀(248) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          Map<Integer,Map<String,List<DocLotDetail>>> amp                            docLotDetailLists.parallelStream().collect(Collectors.groupingBy(DocLotDetail::getGroupOrder,Collectors.groupingBy(DocLotDetail::getBaseValueName)));





          amp.forEach((key,value)->{

                  System.out.println(key);

                   value.forEach((key2,value2)->{

                      System.out.println(key2);

                  });

          });

          最終返回的結(jié)果

          2

          隨機光盤

          3

          資料袋附件

          4

          資料盒附件

          5

          包裝輔料

          8

          前工序物料






          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          posted @ 2016-03-22 16:14 skycity 閱讀(11376) | 評論 (0)編輯 收藏

          cxf webservice客戶端程序在eclipse里面運行的好好的,但是一旦用mvn assembly:assembly將依賴和主代碼打成一個可運行的jar時,調(diào)用就會出現(xiàn)如下錯誤:


          Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:352)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144)

          at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)

          at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)

          at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)

          at com.nabf.start.NABFClient.main(NABFClient.java:30)

          Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered.

          at org.apache.cxf.bus.managers.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:93)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:339)

          ... 6 more

          而用mV clean package dependency:copy-dependencies -DoutputDirectory=target/lib啟動的時候加載lib包下所有的文件也不會出現(xiàn)錯誤

          解決辦法:在pom.xml的build中添加如下,然后執(zhí)行mV clean package,打出來的包就含有依賴包,且問題解決。原因?

                                      <plugin>

          <groupId>org.apache.maven.plugins</groupId>

          <artifactId>maven-shade-plugin</artifactId>

          <version>1.6</version>

          <configuration>

          <archive>

          <manifest>

          <addClasspath>true</addClasspath>

          <mainClass>com.nabf.start.NABFClient</mainClass>

          </manifest>

          </archive>

          </configuration>

          <executions>

          <execution>

          <phase>package</phase>

          <goals>

          <goal>shade</goal>

          </goals>

          <configuration>

          <transformers>

          <transformer

          implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

          <resource>META-INF/cxf/bus-extensions.txt</resource>

          </transformer>

          </transformers>

          </configuration>

          </execution>

          </executions>

          </plugin> 




          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          posted @ 2016-03-04 15:02 skycity 閱讀(2633) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          MessageFormat.format(str,str1,str2,str3)

          用于替換str中{0},{1},{2}這樣的結(jié)構(gòu)

          String.format(str,str1,str2,str3)

          用于匹配str中%s的結(jié)構(gòu)

          posted @ 2015-06-11 16:10 skycity 閱讀(200) | 評論 (0)編輯 收藏

          package com.skycity.framework.utility;
          import javax.crypto.Cipher;
          import javax.crypto.KeyGenerator;
          import javax.crypto.SecretKey;
          import javax.crypto.spec.SecretKeySpec;

          import sun.misc.BASE64Decoder;
          import sun.misc.BASE64Encoder;

          import com.skycity.framework.Constant;

          public class EncryptUtil {
              // 加密字符串
              public static String encryptMode(String keybyte, String src) {
                  try { // 生成密鑰
                      SecretKey deskey = new SecretKeySpec(new BASE64Decoder().decodeBuffer(keybyte), Constant.ALGORITHM); // 加密
                      Cipher c1 = Cipher.getInstance(Constant.ALGORITHM);
                      c1.init(Cipher.ENCRYPT_MODE, deskey);
                      byte[] result = c1.doFinal(src.getBytes());
                      return new BASE64Encoder().encode(result);
                  } catch (java.security.NoSuchAlgorithmException e1) {
                      e1.printStackTrace();
                  } catch (javax.crypto.NoSuchPaddingException e2) {
                      e2.printStackTrace();
                  } catch (java.lang.Exception e3) {
                      e3.printStackTrace();
                  }
                  return null;
              }
           
              // 解密字符串
              public static String decryptMode(String keybyte, String encryStr) {
                  try { // 生成密鑰
                      SecretKey deskey = new SecretKeySpec(new BASE64Decoder().decodeBuffer(keybyte), Constant.ALGORITHM); // 解密
                      Cipher c1 = Cipher.getInstance(Constant.ALGORITHM);
                      c1.init(Cipher.DECRYPT_MODE, deskey);
                      byte[] result = c1.doFinal(new BASE64Decoder().decodeBuffer(encryStr));
                      return new String(result);
                  } catch (java.security.NoSuchAlgorithmException e1) {
                      e1.printStackTrace();
                  } catch (javax.crypto.NoSuchPaddingException e2) {
                      e2.printStackTrace();
                  } catch (java.lang.Exception e3) {
                      e3.printStackTrace();
                  }
                  return null;
              }
              //創(chuàng)建一個密鑰
              public static byte[] createSecretKey() {
          KeyGenerator keygen = null;
          try {
          keygen = KeyGenerator.getInstance(Constant.ALGORITHM);
          SecretKey deskey = keygen.generateKey();
          return deskey.getEncoded();
          } catch (Exception e) {
          LogUtil.error("NoSuchAlgorithmException!");
          }
          return null;
          }
              
              public static void main(String[] args){ 
                  final byte[] keyBytes = createSecretKey();    
                  String key= new BASE64Encoder().encode(keyBytes);
                  String szSrc = "admin";
                  System.out.println("加密前的字符串:" + szSrc);
                  String password = encryptMode(key,szSrc);
                  System.out.println("加密后的字符串:" + password);
          String result = decryptMode(key, password);
                  System.out.println("解密后的字符串:" + result);
              }
          }

          數(shù)據(jù)庫表中有一個字段用于保存Key,一個字段用于保存password,更改密碼的時候,重新生成一個KEY,然后生成一個PASSWORD,匹配保存到數(shù)據(jù)庫中。
          當(dāng)?shù)顷憰r,用數(shù)據(jù)庫保存的KEY和password進行解密,然后與登陸時輸入的password進行比較,如果相等,則成功。
          算法支持AES,DES,DESede,Blowfish等算法

          posted @ 2015-03-27 10:50 skycity 閱讀(210) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          public static String readString = "Print([QDT],[Read([SQLServer#10.176.1.178#Mas2006],[select top 1 print_model + '.jasper' as reportname from tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])],[Read([SQLServer#10.176.1.178#Mas2006],[select  Machine_No, Check_Code, Model_Packing, Start_Date, Material_Name, Material_No, IIPC_part_code, Material_Qty, Print_Order, Machine_Product_No, print_model, SoftWareName, SoftWare_No, SoftWareQty from dbo.tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])])";


          public static void splitScriptWithMethod(String script) {

          // check if args

          String subMethodReg = "";

          if(script.indexOf("Read([") !=script.lastIndexOf("Read([")){

          subMethodReg = "(.+)\\(\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],\\[(.+\\(\\[.+\\]\\))\\]";

          }else{

          subMethodReg = "(.+)\\(\\[(.+)\\],\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\]";

          }

          Pattern p = Pattern.compile(subMethodReg);

          Matcher matcher = p.matcher(readString);

          while (matcher.find()) {

          for (int i = 1; i <= matcher.groupCount(); i++) {  

                      System.out.println("grp " + i + " :" + matcher.group(i));  

                  } 

          }

          }



          grp 1 :Print

          grp 2 :QDT

          grp 3 :Read([SQLServer#10.176.1.178#Mas2006],[select top 1 print_model + '.jasper' as reportname from tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])

          grp 4 :Read([SQLServer#10.176.1.178#Mas2006],[select  Machine_No, Check_Code, Model_Packing, Start_Date, Material_Name, Material_No, IIPC_part_code, Material_Qty, Print_Order, Machine_Product_No, print_model, SoftWareName, SoftWare_No, SoftWareQty from dbo.tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])


          其中,用于匹配(.+)\\(\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],\\[(.+\\(\\[.+\\]\\))\\],print([],[Read([],[],[])],[Read([],[],[])])這樣的結(jié)構(gòu)
          而(.+)\\(\\[(.+)\\],\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],用于匹配print([],[],[Read([],[],[])]這樣的結(jié)構(gòu)

          posted @ 2015-03-27 10:41 skycity 閱讀(217) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); 在/Library/LaunchDaemons下
          新建svn.sh,內(nèi)容如下

          /usr/bin/svnserve -d -r /Users/YingBo/svn/repository


          chmod +x svn.sh


          新建com.skycity.svn.plist,內(nèi)容如下

          <?xml version="1.0" encoding="UTF-8"?>  

          <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

          <plist version="1.0">

            <dict>

              <key>KeepAlive</key>

              <true/>

              <key>Label</key>

              <string>com.skycity.svn</string>

              <key>ProgramArguments</key>

              <array>

              <string>/Library/LaunchDaemons/svn.sh</string>

              </array>

            </dict>

          </plist>


          設(shè)置開機自動啟動

           sudo launchctl load -w /Library/LaunchDaemons/com.skycity.svn.plist


          設(shè)置開機不自動啟動

           sudo launchctl unload -w /Library/LaunchDaemons/com.skycity.svn.plist

          posted @ 2015-03-27 10:36 skycity 閱讀(172) | 評論 (0)編輯 收藏

          查看當(dāng)前java版本
          $ java -version

          java version "1.8.0_25"

          Java(TM) SE Runtime Environment (build 1.8.0_25-b17)

          Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

          $ which java
          /usr/bin/java

          $ ls -l /usr/bin/java

          lrwxr-xr-x  1 root  wheel  74 12 26 10:24 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java


          ls -l /System/Library/Frameworks/JavaVM.framework/Versions/

          total 64

          lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.4 -> CurrentJDK

          lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.4.2 -> CurrentJDK

          lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.5 -> CurrentJDK

          lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.5.0 -> CurrentJDK

          lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.6 -> CurrentJDK

          lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.6.0 -> CurrentJDK

          drwxr-xr-x  8 root  wheel  272 12 26 14:10 A

          lrwxr-xr-x  1 root  wheel    1 12 26 10:24 Current -> A

          lrwxr-xr-x  1 root  wheel   59 12 26 10:24 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents


          由此可知,當(dāng)前java所對應(yīng)的文件是/System/Library/Frameworks/JavaVm.Framework/Vesions/A/Commons/java

           /System/Library/Frameworks/JavaVM.framework/Versions/下的jdk 1.4-1.6的版本,全部指向/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

          posted @ 2015-03-20 10:24 skycity 閱讀(288) | 評論 (0)編輯 收藏

          yum remove ibus* yum remove scim* yum install fcitx fcitx-table fcitx-table-chinese fcitx-pinyin

          posted @ 2015-03-20 09:42 skycity 閱讀(117) | 評論 (0)編輯 收藏

          有這樣一個串
          Read([SQLServer#10.5.219.21#mas_db],[select * from material where machine_seq='!dbo.repair.machine_seq' and b='@@dbo.test.cc' and c='!!dbo.test.dd' and d='@dbo.repair' and e='sd.bf' and f='@aa.bg' and g='#dbo.repair.machine_name' and h=@dbo.repair.owner],[en_US])
          需要解析中間的select * from material where machine_seq='!dbo.repair.machine_seq' and b='@@dbo.test.cc' and c='!!dbo.test.dd' and d='@dbo.repair' and e='sd.bf' and f='@aa.bg' and g='#dbo.repair.machine_name' and h=@dbo.repair.owner
          還需要滿足'@@','@','!'(前后包含單引號),的變量取出來
          @schema.table.fieldName     @dbo.repair.machine_seq要點:獲取界面上某個控件錄入的值;
          #schema.table     #dbo.reapir要點:獲取這個表的記錄行數(shù);
          !schema.table.fieldName   !dbo.repair.qty要點:統(tǒng)計dbo.repair表qty總和. 相當(dāng)于Sum(qty)性質(zhì).
          @@constName   @@User_ID要點:獲取內(nèi)存變量值;

          實現(xiàn)如下:
          package com.lenovo.nabf.util;

          import java.util.ArrayList;
          import java.util.List;
          import java.util.regex.Matcher;
          import java.util.regex.Pattern;

          public class NabfUtilTest {
              public static final Pattern PatternSql = Pattern.compile("\\'(([#!]{1}|[@]{1,2})[\\w\\.]+?)\\'"); // match '@dbo.repair.machine_seq'
              public static final Pattern PatternReadString = Pattern.compile(".+?,\\[([\\w\\.\\s{*!@#=\'}]+?)\\],.+?");  //match Read([db],[sqlstring],[lang])得到sqlstring的值
              public static void main(String args[]){
                   String readString="Read([SQLServer#10.5.219.21#mas_db],[select * from material where "
                      + "machine_seq='!dbo.repair.machine_seq' and b='@@dbo.test.cc' "
                      + "and c='!!dbo.test.dd' and d='@dbo.repair' and e='sd.bf' and f='@aa.bg' "
                      + "and g='#dbo.repair.machine_name' and h=@dbo.repair.owner],[en_US])"; 
                  System.out.println(readString);
                  System.out.println(analysisReadStr(readString));
                  List list=NabfUtil.getRegexMatchedList(readString);
                  for(String s:list){
                       System.out.println(s);
                  }
                  String sqlString = NabfUtil.getStringByAnalysisReadString(readString);
                  System.out.println(sqlString);
              } 
              public static ArrayList getRegexMatchedList(String readString){
                  String sqlString = analysisReadStr(readString);
                  ArrayList matchList=new ArrayList();
                  Matcher matcher = PatternSql.matcher(sqlString);
                  int lastEndIndex = 0;
                  while (matcher.find(lastEndIndex)) {
                      matchList.add(matcher.group(1));
                      lastEndIndex = matcher.end();
                  }
                  return matchList;
              }
              public static String getStringByAnalysisReadString(String readString){
                  String sqlString = analysisReadStr(readString);
                  Matcher matcher = PatternSql.matcher(sqlString);
                  StringBuilder sb = new StringBuilder();
                  int lastEndIndex = 0;
                  while (matcher.find(lastEndIndex)) {
                      sb.append(sqlString.substring(lastEndIndex, matcher.start()));
                      lastEndIndex = matcher.end();
                  }
                  sb.append(sqlString.substring(lastEndIndex));
                  return sb.toString();
              }
              private static String analysisReadStr(String readString){
                  Matcher matcher = PatternReadString.matcher(readString);
                  int lastEndIndex = 0;
                  String sqlString="";
                  while (matcher.find(lastEndIndex)) {
                           sqlString=matcher.group(1);
                           lastEndIndex = matcher.end();
                  }
                  return sqlString;
             }
          }

          posted @ 2015-03-20 09:41 skycity 閱讀(221) | 評論 (0)編輯 收藏

          JDepend 一個開放源代碼的可以用來評價Java程序質(zhì)量的優(yōu)秀工具,它遍歷Java class的文件目錄,以Java包(package)為單位,為每一個包/類自動生成 包的依賴程度,穩(wěn)定性,可靠度等的評價報告,根據(jù)這些報告,我們可以得到包或類之間的依賴關(guān)系,并分析出包的穩(wěn)定程度,抽象程度,是否存在循環(huán)依賴關(guān)系 等。
          我們可以根據(jù)JDepend給出的報告數(shù)據(jù),分析出我們的包是否是可靠的,穩(wěn)定的,健壯的包,是否符合面向?qū)ο蟮脑O(shè)計原則。
          JDepend 一個開放源代碼的可以用來評價Java程序質(zhì)量的優(yōu)秀工具,它遍歷Java class的文件目錄,以Java包(package)為單位,為每一個包/類自動生成 包的依賴程度,穩(wěn)定性,可靠度等的評價報告,根據(jù)這些報告,我們可以得到包或類之間的依賴關(guān)系,并分析出包的穩(wěn)定程度,抽象程度,是否存在循環(huán)依賴關(guān)系 等。
          我們可以根據(jù)JDepend給出的報告數(shù)據(jù),分析出我們的包是否是可靠的,穩(wěn)定的,健壯的包,是否符合面向?qū)ο蟮脑O(shè)計原則。
          一個具有穩(wěn)定性,擴展性,可維護性的軟件系統(tǒng)要求系統(tǒng)設(shè)計遵循面向?qū)ο蟮脑O(shè)計原則。一般來說,面向?qū)ο蟮脑O(shè)計原則要求滿足高聚合,低耦合,禁止循環(huán)依賴等基本原則。
          JDepend生成的Java包的質(zhì)量評價報告主要包括:
          Number of Classes and Interfaces(TC):實現(xiàn)類與抽象接口的數(shù)目
          CC:包內(nèi)具體的實現(xiàn)類的數(shù)目
          AC:包內(nèi)抽象類和接口類的數(shù)目
          Abstractness (A):包的抽象度。指一個包內(nèi)包含的抽象類或接口占整個包中的類的比重。即A=AC/TC,該值處于0,1之間,若A=0,說明包內(nèi)不包含任何抽象類或接口;若A=1,說明包內(nèi)全部是抽象類或接口。
          Efferent Couplings (Ce):離心耦合。被該包依賴的外部包的數(shù)目(i.e. outgoing dependencies),該數(shù)值越大,說明該包越不獨立(因為依賴了別的包),也越不穩(wěn)定。
          Afferent Couplings (Ca):向心耦合。依賴該包(包含的類)的外部包(類)的數(shù)目(i.e. incoming dependencies),該數(shù)值越大,說明該包的擔(dān)當(dāng)?shù)穆氊?zé)越大,也就越穩(wěn)定。
          Instability (I):衡量一個包的不穩(wěn)定程度。I=Ce/(Ce+Ca)。它的值處于[0,1]之間。I=0時,沒有依賴外部包,此時包是最穩(wěn)定的,反之I=1,沒有外部依賴“我”,則說明包極不穩(wěn)定。
          Distance from the Main Sequence (D): 該指標(biāo)主要用來評價包的抽象程度與穩(wěn)定程度的平衡關(guān)系,它可以用二維直線圖 A + I = 1 來表示。D=abs((A + I) - 1),也就是說D為 一個包的抽象度 + 包的不穩(wěn)定程度 - 1 的絕對值。一個理想的包是:完全抽象的(A=1,I=0),非常穩(wěn)定的(I=0),這時D=0;或者是:完全具體類構(gòu)成的包(A=0,I=1),非常不穩(wěn)定的 (I=1),這時同樣也有D=0。D=0說明包的抽象程度與穩(wěn)定程度是平衡的,反之D=1說明包的平衡程度被嚴重破壞。D值越大,越需要受到關(guān)注。                                       
          面向的設(shè)計原則之一The Stable Abstractions Principle (SAP):穩(wěn)定抽象等價原則指出了包的穩(wěn)定程度與它的抽象程度(接口的數(shù)目)成正比,也就是說,一個包內(nèi)包含的接口所占的比重越大,這個包就越穩(wěn)定。

          posted @ 2015-03-20 09:40 skycity 閱讀(219) | 評論 (0)編輯 收藏

           J2SE 8 = 52,
           J2SE 7 = 51,
           J2SE 6.0 = 50,
           J2SE 5.0 = 49,
           JDK 1.4 = 48,
           JDK 1.3 = 47,
           JDK 1.2 = 46,
           JDK 1.1 = 45

          posted @ 2015-03-20 09:38 skycity 閱讀(211) | 評論 (0)編輯 收藏

          萬分號,費率的地方用得著,網(wǎng)上不好找,留著先?

          posted @ 2013-02-21 11:41 skycity 閱讀(200) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2012-09-29 11:36 skycity 閱讀(418) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-12-22 09:24 skycity 閱讀(1082) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-12-18 21:59 skycity 閱讀(291) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-12-17 18:47 skycity 閱讀(2157) | 評論 (1)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-12-16 10:24 skycity 閱讀(931) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-12-10 15:41 skycity 閱讀(5212) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-10-10 15:07 skycity 閱讀(465) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-03-07 21:12 skycity 閱讀(49803) | 評論 (2)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-03-04 22:19 skycity 閱讀(602) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-02-29 15:30 skycity 閱讀(508) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-02-29 14:33 skycity 閱讀(1203) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-02-04 00:21 skycity 閱讀(605) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-12-29 11:09 skycity 閱讀(771) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-12-28 22:00 skycity 閱讀(3303) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-12-20 23:31 skycity 閱讀(479) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-11-05 12:03 skycity 閱讀(650) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-09-03 08:28 skycity 閱讀(8175) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-07-21 23:46 skycity 閱讀(883) | 評論 (1)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-06-26 23:54 skycity 閱讀(1614) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-06-20 11:01 skycity 閱讀(2468) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 新巴尔虎左旗| 卓资县| 东平县| 峡江县| 双柏县| 海城市| 马山县| 揭阳市| 屯昌县| 荆门市| 昌乐县| 衡山县| 夏邑县| 镇江市| 左权县| 富顺县| 晋中市| 莱阳市| 巍山| 论坛| 增城市| 顺平县| 临清市| 荔浦县| 玉龙| 乳源| 将乐县| 彭山县| 凤冈县| 阿克苏市| 阿拉善盟| 卫辉市| 武穴市| 星子县| 凤阳县| 时尚| 鄂尔多斯市| 板桥市| 乐至县| 中江县| 涟水县|