org.mklab.nfc.matx
クラス MatxString

java.lang.Object
  上位を拡張 org.mklab.nfc.matx.MatxAbstractObject
      上位を拡張 org.mklab.nfc.matx.MatxString
すべての実装されたインタフェース:
Cloneable, MatxObject

public class MatxString
extends MatxAbstractObject
implements Cloneable

可変文字列に対して文字列の操作や書式付きの出力を行うためのクラスです。

バージョン:
$Revision: 1.14 $
作成者:
koga

コンストラクタの概要
MatxString()
          文字をもたず、初期容量が 16 文字であるMxStringを生成します。
MatxString(int length)
          文字をもたず、引数 length によって指定された初期容量である MxStringを生成します。
MatxString(String string)
          stringで指定した文字列バッファをもつMxStringを生成します。
 
メソッドの概要
 MatxString add(String string)
          文字列stringを追加たMxSringを返します。
 char charAt(int index)
          indexで指定した位置の文字を返します。
 Object clone()
          Object#clone()
 BooleanMatrix compareElementWise(MatxString opponent, String operator)
          各文字とopponentの各文字をoperatorで指定した演算子で比較し, 結果を BooleanMatrix で返します。
 BooleanMatrix compareElementWise(String operator, char ch)
          各文字列とchをoperatorで指定した演算子で比較し、 結果を BooleanMatrix で返します。
 String getSubString(BooleanMatrix indexMatrix)
          boolean行列のtrueのがある位置の文字列を返します。
 String getSubString(int[] index)
          indexで指定した位置の文字列を返します。
 String getSubString(int from, int to)
          fromからtoまでの部分文字列を返します。
 String getSubString(int from, int step, int to)
          fromからtoまでstep飛びの位置にある部分文字列を返します。
 int length()
          この文字列バッファの長さ (文字数) を返します。
 MatxString multiply(int count)
          count回繰り返した文字列バッファをもつMxStringを返します。
static int mxEquals(String string1, String string2)
          s1とs2が等しいか判定します。
static int mxNotEquals(String string1, String string2)
          s1とs2が等しくないか判定します。
static MatxString readMxFormat(InputStream input)
          MX形式の文字列を入力ストリームから読み込みます。
static MatxString readMxFormat(MxDataHead head, InputStream input)
          MX形式の文字列を入力ストリームから読み込みます。
 void setCharAt(int index, char ch)
          indexで指定した位置の文字をchを代入します。
 void setSubString(int from, int step, int to, String string)
          fromからtoまでstep飛びの位置にある文字をstrで置き換える。
 void setSubString(int from, int to, String string)
          fromからtoまでをstringで置き換える。
 String toMmString()
          MM形式の文字列を生成します。
 String toMmString(String format)
          MM形式の文字列を生成します。
 String toString()
          保持するStringを返します。
static void writeMmFormat(String str, Writer output, String name)
          MM形式で文字列をライターへ出力します。
static void writeMmFormat(String str, Writer output, String name, boolean withNewLine)
          MM形式で文字列をライターへ出力します。
 void writeMmFormat(Writer output, String name, boolean withNewLine)
          MMフォーマット行列データをライターに出力します。
 void writeMxFormat(OutputStream output, String name)
          データをMX形式で出力ストリームへ出力します。
static void writeMxFormat(String str, OutputStream output, String name)
          MX形式で文字列を出力ストリームに出力します。
 
クラス org.mklab.nfc.matx.MatxAbstractObject から継承されたメソッド
writeMmFormat, writeMxFormat
 
クラス java.lang.Object から継承されたメソッド
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

MatxString

public MatxString()
文字をもたず、初期容量が 16 文字であるMxStringを生成します。


MatxString

public MatxString(int length)
文字をもたず、引数 length によって指定された初期容量である MxStringを生成します。

パラメータ:
length - 初期容量

MatxString

public MatxString(String string)
stringで指定した文字列バッファをもつMxStringを生成します。

パラメータ:
string - 文字列
メソッドの詳細

toString

public String toString()
保持するStringを返します。

オーバーライド:
クラス Object 内の toString
戻り値:
保持するString

add

public MatxString add(String string)
文字列stringを追加たMxSringを返します。

パラメータ:
string - 追加する文字列。
戻り値:
stringを追加したMxString

length

public int length()
この文字列バッファの長さ (文字数) を返します。

戻り値:
文字数

multiply

public MatxString multiply(int count)
count回繰り返した文字列バッファをもつMxStringを返します。

パラメータ:
count - 繰り返し回数
戻り値:
n回繰り返した文字をもつMxString

charAt

public char charAt(int index)
indexで指定した位置の文字を返します。

パラメータ:
index - 指定位置
戻り値:
文字

setCharAt

public void setCharAt(int index,
                      char ch)
indexで指定した位置の文字をchを代入します。

パラメータ:
index - 指定位置
ch - 変更文字

getSubString

public String getSubString(int from,
                           int to)
fromからtoまでの部分文字列を返します。

パラメータ:
from - 開始位置
to - 終了位置
戻り値:
fromからtoまでの部分文字列

getSubString

public String getSubString(int from,
                           int step,
                           int to)
fromからtoまでstep飛びの位置にある部分文字列を返します。

パラメータ:
from - 開始位置
step - ステップ数
to - 終了位置
戻り値:
選択された文字からなる部分文字列

getSubString

public String getSubString(int[] index)
indexで指定した位置の文字列を返します。

パラメータ:
index - 位置指定行列
戻り値:
indexで指定した位置の文字列

getSubString

public String getSubString(BooleanMatrix indexMatrix)
boolean行列のtrueのがある位置の文字列を返します。

パラメータ:
indexMatrix - 文字列を取り出す位置の要素がtrueであるboolean行列
戻り値:
生成した文字列

setSubString

public void setSubString(int from,
                         int to,
                         String string)
fromからtoまでをstringで置き換える。

パラメータ:
from - 開始位置
to - 終了位置
string - 変更文字列

setSubString

public void setSubString(int from,
                         int step,
                         int to,
                         String string)
fromからtoまでstep飛びの位置にある文字をstrで置き換える。

パラメータ:
from - 開始位置
step - step数
to - 終了位置
string - 変更文字列

mxEquals

public static int mxEquals(String string1,
                           String string2)
s1とs2が等しいか判定します。

パラメータ:
string1 - 比較する文字列
string2 - 比較する文字列
戻り値:
等しければ1、そうでなければ0

mxNotEquals

public static int mxNotEquals(String string1,
                              String string2)
s1とs2が等しくないか判定します。

パラメータ:
string1 - 比較する文字列
string2 - 比較する文字列
戻り値:
異なっていれば1、そうでなければ0

compareElementWise

public BooleanMatrix compareElementWise(String operator,
                                        char ch)
各文字列とchをoperatorで指定した演算子で比較し、 結果を BooleanMatrix で返します。

パラメータ:
operator - 演算を表す文字列
ch - 演算の対象となる文字
戻り値:
演算の結果を表すboolean行列

compareElementWise

public BooleanMatrix compareElementWise(MatxString opponent,
                                        String operator)
各文字とopponentの各文字をoperatorで指定した演算子で比較し, 結果を BooleanMatrix で返します。

パラメータ:
opponent - 比較する対象の文字列
operator - 演算子
戻り値:
比較結果を成分とするboolean行列

writeMxFormat

public void writeMxFormat(OutputStream output,
                          String name)
                   throws IOException
インタフェース MatxObject の記述:
データをMX形式で出力ストリームへ出力します。 outputがcloseされるまで、いくつでも出力可能です。

定義:
インタフェース MatxObject 内の writeMxFormat
パラメータ:
output - 出力ストリーム
name - データの名前
例外:
IOException - 出力ストリームに出力できない場合
関連項目:
MatxObject.writeMxFormat(java.io.OutputStream, java.lang.String)

writeMxFormat

public static void writeMxFormat(String str,
                                 OutputStream output,
                                 String name)
                          throws IOException
MX形式で文字列を出力ストリームに出力します。

パラメータ:
str - 出力する文字列
output - 出力ストリーム
name - 名前
例外:
IOException - ストリームに出力できない場合

readMxFormat

public static MatxString readMxFormat(InputStream input)
                               throws IOException
MX形式の文字列を入力ストリームから読み込みます。

パラメータ:
input - 入力ストリーム
戻り値:
MxStringのインスタンス
例外:
IOException - 入力ストリームから読み込めない場合

readMxFormat

public static MatxString readMxFormat(MxDataHead head,
                                      InputStream input)
                               throws IOException
MX形式の文字列を入力ストリームから読み込みます。 ヘッダ情報は先に取得している。

パラメータ:
input - 入力ストリーム
head - ヘッダ情報
戻り値:
MxStringのインスタンス
例外:
IOException - 入力ストリームから読み込めない場合

writeMmFormat

public void writeMmFormat(Writer output,
                          String name,
                          boolean withNewLine)
                   throws IOException
インタフェース MatxObject の記述:
MMフォーマット行列データをライターに出力します。

定義:
インタフェース MatxObject 内の writeMmFormat
パラメータ:
output - ライター
name - 名前
withNewLine - セミコロンと改行コードを出力するならばtrue、そうでなければfalse
例外:
IOException - ライターに出力できない場合
関連項目:
MatxObject.writeMmFormat(java.io.Writer, java.lang.String, boolean)

writeMmFormat

public static void writeMmFormat(String str,
                                 Writer output,
                                 String name)
                          throws IOException
MM形式で文字列をライターへ出力します。

パラメータ:
str - 出力する文字列
output - ライター
name - 名前
例外:
IOException - ライターへ出力できない場合

writeMmFormat

public static void writeMmFormat(String str,
                                 Writer output,
                                 String name,
                                 boolean withNewLine)
                          throws IOException
MM形式で文字列をライターへ出力します。

パラメータ:
str - 出力する文字列
output - ライター
name - 名前
withNewLine - 改行コードを出力するならばtrue、そうでなければfalse
例外:
IOException - ライターへ出力できない場合

clone

public Object clone()
Object#clone()

オーバーライド:
クラス Object 内の clone

toMmString

public String toMmString()
インタフェース MatxObject の記述:
MM形式の文字列を生成します。

定義:
インタフェース MatxObject 内の toMmString
戻り値:
MM形式の文字列
関連項目:
MatxObject.toMmString()

toMmString

public String toMmString(String format)
インタフェース MatxObject の記述:
MM形式の文字列を生成します。

定義:
インタフェース MatxObject 内の toMmString
パラメータ:
format - 出力フォーマット
戻り値:
MM形式の文字列
関連項目:
MatxObject.toMmString(java.lang.String)