All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.houbb.chinese.idiom.bs.ChineseIdiomBs Maven / Gradle / Ivy

There is a newer version: 0.0.2
Show newest version
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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy