程序包 cn.denghanxi.s51
类 Alphabet
- java.lang.Object
-
- cn.denghanxi.s51.Alphabet
-
public class Alphabet extends Object
字母表
-
-
构造器详细资料
-
Alphabet
public Alphabet(String s)
根据s中的字符构造字符表- 参数:
s- 字符串
-
-
方法详细资料
-
toChar
public char toChar(int index)
获取字符表中索引位置的字符- 参数:
index- 索引位置- 返回:
- 字符
-
toIndex
public int toIndex(char c)
获取c的索引,在 0 到 R-1 之间- 参数:
c- 字符c- 返回:
- 索引位置
-
contains
public boolean contains(char c)
是否包含字符c- 参数:
c- 字符c- 返回:
- 是否在字母表中
-
r
public int r()
基数-字母表中的字符数量 /- 返回:
- 基数
-
lgR
public int lgR()
一个索引所需要的比特数- 返回:
- 比特数
-
toIndices
public int[] toIndices(String s)
将s转换为R进制的整数- 参数:
s- s- 返回:
- 整数数组
-
toChars
public String toChars(int[] indices)
将R进制的整数转换为基于该字母表的字符串- 参数:
indices- 整数数组- 返回:
- 字符串
-
-