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

com.scudata.ide.spl.etl.element.CsFetch Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.ide.spl.etl.element;

import java.util.StringTokenizer;

import com.scudata.chart.Consts;
import com.scudata.ide.spl.etl.EtlConsts;
import com.scudata.ide.spl.etl.ObjectElement;
import com.scudata.ide.spl.etl.ParamInfo;
import com.scudata.ide.spl.etl.ParamInfoList;

/**
 * ?????????༭ CS.fetch()
 * ??????ǰ׺Cs??ʾ?α?
 * 
 * @author Joancy
 *
 */
public class CsFetch extends ObjectElement {
	public String fetchN;
	public String groupX;
	
	public boolean zero;
	public boolean x;

	/**
	 * ??ȡ???ڽ???༭?IJ?????Ϣ?б?
	 */
	public ParamInfoList getParamInfoList() {
		ParamInfoList paramInfos = new ParamInfoList();
		ParamInfo.setCurrent(CsFetch.class, this);

		paramInfos.add(new ParamInfo("fetchN"));
		paramInfos.add(new ParamInfo("groupX", EtlConsts.INPUT_ONLYPROPERTY));
		String group = "options";
		paramInfos.add(group, new ParamInfo("zero", Consts.INPUT_CHECKBOX));
		paramInfos.add(group, new ParamInfo("x", Consts.INPUT_CHECKBOX));

		return paramInfos;
	}


	/**
	 * ??ȡ??????
	 * ???͵ij???????Ϊ
	 * EtlConsts.TYPE_XXX
	 * @return EtlConsts.TYPE_CURSOR
	 */
	public byte getParentType() {
		return EtlConsts.TYPE_CURSOR;
	}

	/**
	 * ??ȡ?ú????ķ???????
	 * @return EtlConsts.TYPE_SEQUENCE
	 */
	public byte getReturnType() {
		return EtlConsts.TYPE_SEQUENCE;
	}

	/**
	 * ??ȡ????????SPL????ʽ??ѡ?
	 */
	public String optionString(){
		StringBuffer options = new StringBuffer();
		if(zero){
			options.append("0");
		}else if(x){
			options.append("x");
		}
		return options.toString();
	}

	/**
	 * ??ȡ????????SPL????ʽ?ĺ?????
	 */
	public String getFuncName() {
		return "fetch";
	}

	/**
	 * ??ȡ????????SPL????ʽ?ĺ?????
	 * ??setFuncBody???溯????Ȼ?????ʽ?ĸ?ֵҲ???ǻ????
	 */
	public String getFuncBody() {
		StringBuffer sb = new StringBuffer();
		String buf = getNumberExp(fetchN);
		if(!buf.isEmpty()){
			sb.append(buf);
		}
		buf = getExpressionExp(groupX);
		if(!buf.isEmpty()){
			sb.append(";");
			sb.append(buf);
		}
		return sb.toString();
	}

	/**
	 * ???ú?????
	 * @param funcBody ??????
	 */
	public boolean setFuncBody(String funcBody) {
		StringTokenizer st = new StringTokenizer(funcBody,";");
		String buf = st.nextToken(); 
		fetchN = getNumber( buf );
		
		if(st.hasMoreTokens()){
			buf = st.nextToken();
			groupX = getExpression(buf);
		}
		return true;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy