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

com.scudata.chart.edit.ParamInfoList 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.chart.edit;

import java.util.*;

import com.scudata.chart.resources.*;
import com.scudata.common.*;

/**
 * ??????Ϣ?б??࣬???ڱ༭??????г?ͼԪ?Ŀɱ༭??????Ϣ
 * @author Joancy
 *
 */
public class ParamInfoList {
	ArrayList> paramGroups = new ArrayList>();
	ArrayList groupNames = new ArrayList();

	ArrayList rootList = new ArrayList();
	private final static String ROOTGROUP = "RootGroup";
	private MessageManager mm = ChartMessage.get();

	/**
	 * ȱʡ???????캯??
	 */
	public ParamInfoList() {
	}

	private ArrayList> getParamGroups() {
		return paramGroups;
	}

	private ArrayList getrootList() {
		return rootList;
	}

	/**
	 * ????һ????????Ϣ?б???????ȫ?????ӵ???ǰ?б?
	 * @param pil ??????Ϣ?б?
	 */
	public void addAll(ParamInfoList pil) {
		//pil?з???????Ҫ??????????????ͬ???ƺϲ????ij????´???
		ArrayList groupNames = pil.getGroupNames();
		for( int i=0; i grpParams = pil.getParams(grpName);
			for( int n=0;n pis = null;
		if (group == null || ROOTGROUP.equalsIgnoreCase(group)) {
			pis = rootList;
		} else {
			group = mm.getMessage(group);
			int index = groupNames.indexOf(group);
			if (index < 0) {
				groupNames.add(group);
				pis = new ArrayList();
				paramGroups.add(pis);
			} else {
				pis = paramGroups.get(index);
			}
		}
		if (pis == null) {
			pis = rootList;
		}
		pis.add(pi);
	}
	
	/**
	 * ijЩ???಻??Ҫ?????ж???õIJ?????Ϣʱ??????ɾ????
	 * ?ú???ɾ?????????µ???Ϣ
	 * @param group ????????
	 */
	public void deleteGroup(String group){
		group = mm.getMessage(group);
		int index = groupNames.indexOf(group);
		if (index >=0 ) {
			groupNames.remove(index);
			paramGroups.remove(index);
		}
	}

	/**
	 * ɾ??????group?µ?һ????????Ϣ
	 * @param group ??????
	 * @param name ??????Ϣ??????
	 */
	public void delete(String group, String name){
		group = mm.getMessage(group);
		delete(getParams(group),name);
	}
	
	/**
	 * ????·???£?Ҳ?????????κη??飬????һ????????Ϣ
	 * @param pi ??????Ϣ
	 */
	public void add(ParamInfo pi) {
		rootList.add(pi);
	}
	
	/**
	 * ɾ????Ŀ¼?µIJ?????Ϣ
	 * @param name ????????
	 */
	public void delete(String name){
		delete(rootList,name);
	}
	
	/**
	 * ??ָ???IJ?????Ϣ?б???ɾ??һ????????Ϣ
	 * @param list ??????Ϣ?б?
	 * @param name Ҫɾ???IJ???????
	 */
	public void delete(ArrayList list,String name){
		for(int i=0; i getGroupNames() {
		return groupNames;
	}

	/**
	 * ??ȡһ??????????в?????Ϣ?б?
	 * @param groupName ????????
	 * @return ??????Ϣ?б?
	 */
	public ArrayList getParams(String groupName) {
		ArrayList pis = null;
		int index = groupNames.indexOf(groupName);
		if (index >= 0) {
			pis = paramGroups.get(index);
		}
		if (pis != null)
			return pis;
		return rootList;
	}

	/**
	 * ??ȡ??Ŀ¼?µ?ȫ????????Ϣ?б?
	 * @return ??????Ϣ?б?
	 */
	public ArrayList getRootParams() {
		return rootList;
	}

	/**
	 * ?????в?????Ϣ???ҵ???Ӧ?IJ?????Ϣ
	 * @param name ????????
	 * @return ??????Ϣ
	 */
	public ParamInfo getParamInfoByName(String name) {
		ArrayList aps = getAllParams();
		int infoSize = aps.size();
		for (int i = 0; i < infoSize; i++) {
			ParamInfo pi = (ParamInfo) aps.get(i);
			if (pi.getName().equalsIgnoreCase(name)) {
				return pi;
			}
		}
		return null;
	}

	/**
	 * ?г????в?????Ϣ???ۺ??б?????????Ŀ¼?Լ????????з???
	 * @return ȫ????????Ϣ?б?
	 */
	public ArrayList getAllParams() {
		ArrayList aps = new ArrayList();
		int size = rootList == null ? 0 : rootList.size();
		for (int i = 0; i < size; i++) {
			aps.add(rootList.get(i));
		}
		size = paramGroups == null ? 0 : paramGroups.size();
		for (int i = 0; i < size; i++) {
			ArrayList pis = paramGroups.get(i);
			int ps = pis == null ? 0 : pis.size();
			for (int j = 0; j < ps; j++) {
				aps.add(pis.get(j));
			}
		}
		return aps;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy