Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
汉化getInstance方法;更新gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
testacount1 committed Jul 19, 2017
1 parent 77c62a7 commit e4f6f56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
/dist/
/classes/
**/.DS_Store
.classpath
.project
.*
8 changes: 4 additions & 4 deletions src/com/spreada/utils/chinese/简繁转换类.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2017 Xuan Wu 吴烜
/* Copyright 2017 吴烜 (Xuan Wu)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
Expand All @@ -22,15 +22,15 @@
public class 简繁转换类 {

public enum 目标 {
繁体, 简体;
繁体, 简体
}
private final static 简繁转换类 简体转换器 = new 简繁转换类();
private final static 简繁转换类 繁体转换器 = new 简繁转换类();

private Properties 字符表 = new Properties();
private Properties 短语表 = new Properties();

public static 简繁转换类 getInstance(目标 简繁) {
public static 简繁转换类 取实例(目标 简繁) {
if (简繁.equals(目标.繁体)) {
繁体转换器.读取字表("简到繁单字.properties", "简到繁短语.properties");
return 繁体转换器;
Expand All @@ -49,7 +49,7 @@ public enum 目标 {
* @return 转换为目标格式的文本
*/
public static String 转换(String 文本, 目标 简繁) {
return getInstance(简繁).转换(文本);
return 取实例(简繁).转换(文本);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/com/spreada/utils/chinese/简繁转换测试类.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class 简繁转换测试类 {

@Test
public void 基本转换测试() {
final 简繁转换类 繁体转换器 = 简繁转换类.getInstance(目标.繁体);
final 简繁转换类 简体转换器 = 简繁转换类.getInstance(目标.简体);
final 简繁转换类 繁体转换器 = 简繁转换类.取实例(目标.繁体);
final 简繁转换类 简体转换器 = 简繁转换类.取实例(目标.简体);

assertEquals("簡單", 繁体转换器.转换("简单"));
assertEquals("简单", 简体转换器.转换("簡單"));
Expand Down

0 comments on commit e4f6f56

Please sign in to comment.