com.github.houbb.chinese.idiom.bs.ChineseIdiomBs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chinese-idiom Show documentation
Show all versions of chinese-idiom Show documentation
The chinese-idiom tools for chinese by java.
package com.github.houbb.chinese.idiom.bs;
import com.github.houbb.chinese.common.api.IChineseCondition;
import com.github.houbb.chinese.common.api.IChineseContext;
import com.github.houbb.chinese.common.api.IChineseInfo;
import com.github.houbb.chinese.common.api.IChineseInfoService;
import com.github.houbb.chinese.common.bs.IChineseInfoBs;
import com.github.houbb.chinese.common.support.condition.ChineseConditions;
import com.github.houbb.chinese.common.support.context.ChineseContext;
import com.github.houbb.chinese.common.support.core.ChineseInfoService;
import com.github.houbb.chinese.common.support.data.IChineseData;
import com.github.houbb.chinese.idiom.support.data.ChineseIdiomData;
import com.github.houbb.heaven.support.instance.impl.Instances;
import java.util.List;
/**
* @author binbin.hou
* @since 0.0.1
*/
public class ChineseIdiomBs implements IChineseInfoBs {
/**
* 中文数据信息
* @since 0.0.1
*/
private IChineseData chineseData = Instances.singleton(ChineseIdiomData.class);
/**
* 中文信息过滤处理
* @since 0.0.1
*/
private IChineseInfoService chineseInfoService = Instances.singleton(ChineseInfoService.class);
/**
* 创建新的对象实例
* @return 实例
* @since 0.0.1
*/
public static ChineseIdiomBs newInstance() {
return new ChineseIdiomBs();
}
@Override
public List contains(String s, int i) {
IChineseCondition condition = ChineseConditions.contains();
IChineseContext context = ChineseContext.newInstance().text(s).limit(i).data(chineseData);
return chineseInfoService.list(condition, context);
}
@Override
public List startWith(String s, int i) {
IChineseCondition condition = ChineseConditions.startWith();
IChineseContext context = ChineseContext.newInstance().text(s).limit(i).data(chineseData);
return chineseInfoService.list(condition, context);
}
@Override
public List endWith(String s, int i) {
IChineseCondition condition = ChineseConditions.endWith();
IChineseContext context = ChineseContext.newInstance().text(s).limit(i).data(chineseData);
return chineseInfoService.list(condition, context);
}
@Override
public List withNum(int i, int i1) {
IChineseCondition condition = ChineseConditions.wordNum();
IChineseContext context = ChineseContext.newInstance().wordNum(i).limit(i1).data(chineseData);
return chineseInfoService.list(condition, context);
}
@Override
public List withStyle(String s, int i) {
IChineseCondition condition = ChineseConditions.wordStyle();
IChineseContext context = ChineseContext.newInstance().wordStyle(s).limit(i).data(chineseData);
return chineseInfoService.list(condition, context);
}
}