use of jp.ossc.nimbus.util.CsvArrayList in project nimbus by nimbus-org.
the class NumericSequenceService method startService.
/**
* サービスの開始処理を行う。<p>
*
* @exception Exception サービスの開始処理に失敗した場合
*/
public void startService() {
synchronized (this) {
// formatを桁区切りで分解する
CsvArrayList parser = new CsvArrayList();
parser.split(mFormat, C_SEMICORON);
// 桁情報リストをインスタンシングする
mSequenceNo = new ArrayList();
// 各桁情報をインスタンシングしてリストに格納する
for (Iterator iterator = parser.iterator(); iterator.hasNext(); ) {
String formatItem = (String) iterator.next();
final SequenceVariable item = new SimpleSequenceVariable(formatItem);
mSequenceNo.add(item);
}
mInitialFlag = true;
mInitialNumber = "";
}
}
use of jp.ossc.nimbus.util.CsvArrayList in project nimbus by nimbus-org.
the class NumericSequenceService method setFormat.
// NumericSequenceServiceMBean のJavaDoc
public void setFormat(String format) {
synchronized (this) {
// formatを桁区切りで分解する
CsvArrayList parser = new CsvArrayList();
parser.split(format, C_SEMICORON);
if (parser.size() != 2) {
throw new ServiceException("NUMERICSEQ001", "fromat is invalid format = " + format);
// $NON-NLS-1$ //$NON-NLS-2$
}
mMin = parser.getStr(0);
mMax = parser.getStr(1);
if (!StringOperator.isNumeric(mMin)) {
throw new ServiceException("NUMERICSEQ002", "MIN is not numeric min = " + mMin);
// $NON-NLS-1$ //$NON-NLS-2$
}
if (!StringOperator.isNumeric(mMax)) {
throw new ServiceException("NUMERICSEQ003", "MAX is not numeric max = " + mMax);
// $NON-NLS-1$ //$NON-NLS-2$
}
StringBuilder tmpFormat = new StringBuilder();
for (int cnt = 0; cnt < mMax.length(); cnt++) {
tmpFormat.append(C_ZERO_WITH_COMMMA);
tmpFormat.append(C_NINE);
if (cnt != mMax.length() - 1) {
tmpFormat.append(C_SEMICORON);
}
}
mFormat = tmpFormat.toString();
}
}
use of jp.ossc.nimbus.util.CsvArrayList in project nimbus by nimbus-org.
the class CsvArrayListTest method testJoinCL.
public void testJoinCL() {
CsvArrayList ary = new CsvArrayList();
ary.add("nakano");
ary.add("hirotaka");
String tmp = ary.joinCL();
System.out.println(tmp);
}
use of jp.ossc.nimbus.util.CsvArrayList in project nimbus by nimbus-org.
the class CsvArrayListTest method testSplitStringString.
/*
* int split のテスト(String, String)
*/
public void testSplitStringString() throws Exception {
CsvArrayList ary = new CsvArrayList();
ary.split("nakano@@hirotaka@baka@@hirotaka@tensai", "@@");
if (ary.size() != 3) {
throw new Exception();
}
if (!ary.getStr(0).equals("nakano")) {
throw new Exception();
}
if (!ary.getStr(1).equals("hirotaka@baka")) {
throw new Exception();
}
if (!ary.getStr(2).equals("hirotaka@tensai")) {
throw new Exception();
}
}
use of jp.ossc.nimbus.util.CsvArrayList in project nimbus by nimbus-org.
the class CsvArrayListTest method testSplitExcel.
/*
* int splitExcelFile のテスト(String)
*/
public void testSplitExcel() throws Exception {
CsvArrayList ary = new CsvArrayList();
FileReader file;
file = new FileReader("src/test/resources/jp/ossc/nimbus/util/test1.csv");
BufferedReader in = new BufferedReader(file);
String line = in.readLine();
ary.splitExcelFile(line);
assertEquals(ary.get(0), "あいうえお");
assertEquals(ary.get(1), "あ\"い\"う\"え\"お\"");
if (ary.size() != 3) {
throw new Exception();
}
line = in.readLine();
ary.splitExcelFile(line);
assertEquals(ary.get(0), "かきくけこ");
assertEquals(ary.get(1), "か\"き\"く\"け\"こ\"");
if (ary.size() != 3) {
throw new Exception();
}
ary.clear();
in.close();
file.close();
}
Aggregations