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

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

Go to download

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

The newest version!
package com.scudata.ide.spl.etl.element;

import java.util.ArrayList;
import java.util.StringTokenizer;

import com.scudata.chart.Consts;
import com.scudata.common.StringUtils;
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.sortx()
 * ??????ǰ׺Cs??ʾ?α?
 * 
 * @author Joancy
 *
 */
public class CsSortx extends ObjectElement {
	public ArrayList sortFields;

	public String bufferN;
	
	public boolean zero;
	public boolean n;
	
	/**
	 * ??ȡ???ڽ???༭?IJ?????Ϣ?б?
	 */
	public ParamInfoList getParamInfoList() {
		ParamInfoList paramInfos = new ParamInfoList();
		ParamInfo.setCurrent(CsSortx.class, this);

		paramInfos.add(new ParamInfo("sortFields",EtlConsts.INPUT_STRINGLIST));
		paramInfos.add(new ParamInfo("bufferN"));

		String group = "options";			
		paramInfos.add(group, new ParamInfo("zero", Consts.INPUT_CHECKBOX));
		paramInfos.add(group, new ParamInfo("n", Consts.INPUT_CHECKBOX));
		

		return paramInfos;
	}

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

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

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

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

	/**
	 * ??ȡ????????SPL????ʽ?ĺ?????
	 * ??setFuncBody???溯????Ȼ?????ʽ?ĸ?ֵҲ???ǻ????
	 */
	public String getFuncBody() {
		StringBuffer sb = new StringBuffer();
		sb.append( getStringListExp(sortFields,",") );
		
		if(StringUtils.isValidString( bufferN )){
			sb.append(";");
			String buf = getNumberExp(bufferN);
			sb.append(buf);
		}
		return sb.toString();
	}

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy