2023年6月21日发(作者:)

mysql正态分布函数_正态分布图⽰例-SmartbiV6帮助中⼼-Smartbi在线知识。。。package ery;import edReader;import ;import dParameterException;import tion;import edStatement;import Set;import ist;import tions;import HashMap;import ;import ;import ;import ;import tionPool;import ueryData;import eryConfig;import eryOutputField;import eryParameter;import ta;import ta;import ject;import ;import Util;import ype;public class CellStringSplitToRows implements IJavaQueryData {public static final String CN_DS_ID = "DS_ID"; // config namepublic static final String CN_QUERY_SQL = "QUERY_SQL"; // config namepublic static final String CN_IGNORE_EMPTY_VALUE = "IGNORE_EMPTY_VALUE"; // config namepublic static final String SPLIT_DELIMITER = ",";protected static final String ID_OUTPUT_FIELD_1 = "VALUES";protected static final String NAME_OUTPUT_FIELD_1 = "values";protected static final String ID_PARAMETER_1 = "SQL_PARAMETER_VALUES";protected static final String NAME_PARAMETER_1 = "sqlParameterValues";protected static final boolean USE_CACHE_DATA = false;protected static final Logger LOG = ger();protected Map configs = new LinkedHashMap();protected List outputFields;protected List parameters;protected String sqlParameterValues;protected List dataStore;public CellStringSplitToRows() {String sql = "select STAT_VALUE from _MONITOR_MAN where COND_ID=? and FLIGHT_DATE=?"+ " and TO_AIRPORT_ID=? and LD_AIRPORT_ID=? and FLIGHT_NO=? and FLIGHT_SEGMENT=?";addConfig(CN_DS_ID, "数据源ID", "执⾏SQL所对应的数据源ID", "", true);addConfig(CN_QUERY_SQL, "查询SQL", "获取待分隔字符串的查询SQL", sql, true);addConfig(CN_IGNORE_EMPTY_VALUE, "忽略空值", "分隔字符串后空⽩值是否忽略,需要忽略填"true"否则填"false"", "true",false);}/*** 添加⼀个配置项** @param name* 名称* @param alias* 别名* @param desc* 描述* @param defaultValue* 默认值* @param notNull* 是否允许为空*/private void addConfig(String name, String alias, String desc, String defaultValue,boolean notNull) {JavaQueryConfig p = new JavaQueryConfig();e(name);as(alias);c(desc);ue(defaultValue);Null(notNull);(name, p);}/*** 从保存的字符串中恢复配置信息** @param configs* 配置字符串*/public void loadConfigs(String configStr) {if (OrEmpty(configStr)) {return;}JSONObject obj = ring(configStr);(CN_DS_ID).setValue((CN_DS_ID) ? ing(CN_DS_ID) : null);(CN_QUERY_SQL).setValue((CN_QUERY_SQL) ? ing(CN_QUERY_SQL) : null);(CN_IGNORE_EMPTY_VALUE).setValue((CN_IGNORE_EMPTY_VALUE) ? ing(CN_IGNORE_EMPTY_VALUE) : null);}/*** 保存配置信息** @return 返回配置字符串*/public String saveConfigs() {JSONObject json = new JSONObject();for (JavaQueryConfig config : ()) {(e(), ue());}return ng();}/*** 获取Java查询需要的配置信息*/public List getConfigs() {return new ArrayList(());}/*** 设置配置信息** @param key* 名称* @param value* 配置值*/public void setConfigValue(String key, String value) {(key).setValue(value);}/*** 设置配置信息*/public void setConfigValues(Map configValues) {for (Entry config : et()) {(()).setValue(ue());}}/*** 根据配置信息初始化Java查询对象*/public void init() {initOutputFields();initParameters();}/*** 初始化输出字段*/protected void initOutputFields() {outputFields = new ArrayList();(new JavaQueryOutputField(ID_OUTPUT_FIELD_1, NAME_OUTPUT_FIELD_1, "values","", , ""));}/*** 初始化查询参数*/protected void initParameters() {parameters = new ArrayList();(new JavaQueryParameter(ID_PARAMETER_1, NAME_PARAMETER_1, "SQL参数值","执⾏查询SQL所需参数值,值与值之间英⽂逗号(,)分隔", , true));}/*** 返回参数对象*/public List getParameters() {return parameters;}/*** 返回Java查询的输出字段*/public List getOutputFields() {return outputFields;}/*** 设置参数值*/public void setParameterValue(String id, String value, String displayValue) {if (ID_PARAMETER_(id)) {sqlParameterValues = value == null ? null : eAll("^'|'$", "");dataStore = null; // reset}}/*** 返回总⾏数,返回_VALUE表⽰未知总⾏数*/public int getRowCount() {if (dataStore != null) {return ();} else {return _VALUE;}}/*** 关闭Java查询对象,关闭必要的资源*/public void close() {dataStore = null;}public synchronized List getValues() throws Exception {if (dataStore == null || !USE_CACHE_DATA) {Connection conn = null;PreparedStatement prep = null;ResultSet rs = null;try {String dsId = (CN_DS_ID).getValue();String sql = (CN_QUERY_SQL).getValue();boolean ignoreEmptyValue = !"false".equals((CN_IGNORE_EMPTY_VALUE).getValue());conn = tance().getConnection(dsId);prep = eStatement(sql);if (!OrEmpty(sqlParameterValues)) {int count = () - eAll("?", "").length();String[] values = (",");for (int i = 0, len = (count, ); i < len; i++) {ing(i + 1, values[i]);}}(sql + "; params=" + sqlParameterValues);rs = eQuery();List list = new ArrayList();while (()) {Reader reader = racterStream(1);BufferedReader br = new BufferedReader(reader);String line;while ((line = ne()) != null) {String[] items = (SPLIT_DELIMITER);for (String item : items) {if (ignoreEmptyValue && OrEmpty(item)) {continue;}(ignoreEmptyValue ? () : item);}}}dataStore = fiableList(list);} catch (Exception e) {(sage(), e);throw e;} finally {BObject(rs, prep, conn);}}return dataStore;}/*** 检测输⼊参数是否合法** @param from* @param count*/protected void assertGetDataParams(int from, int count) {if (from < 0 || count < 1) {throw new InvalidParameterException("parameter [from] must greater -1 and [count] must greater 0. current from="+ from + ", count=" + count);}}/*** 获取指定⾏的数据*/public GridData getGridData(int from, int count) {assertGetDataParams(from, count);List values = null;try {values = getValues();} catch (Exception e) {throw new RuntimeException(sage(), e);}List> datas = new ArrayList>();if (values != null && () > 0) {int toIndex = ((), from + count);for (String value : t(from, toIndex)) {List rowData = new ArrayList();CellData cellData = new CellData();ingValue(value);Double d = 0.0;try {d = ouble(value);} catch (NumberFormatException e) {}bleValue(Value());(cellData);(rowData);}}GridData grid = new GridData();List headers = new ArrayList();for (JavaQueryOutputField f : getOutputFields()) {(e());}ingHeaders(headers);a(datas);return grid;}}

2023年6月21日发(作者:)

mysql正态分布函数_正态分布图⽰例-SmartbiV6帮助中⼼-Smartbi在线知识。。。package ery;import edReader;import ;import dParameterException;import tion;import edStatement;import Set;import ist;import tions;import HashMap;import ;import ;import ;import ;import tionPool;import ueryData;import eryConfig;import eryOutputField;import eryParameter;import ta;import ta;import ject;import ;import Util;import ype;public class CellStringSplitToRows implements IJavaQueryData {public static final String CN_DS_ID = "DS_ID"; // config namepublic static final String CN_QUERY_SQL = "QUERY_SQL"; // config namepublic static final String CN_IGNORE_EMPTY_VALUE = "IGNORE_EMPTY_VALUE"; // config namepublic static final String SPLIT_DELIMITER = ",";protected static final String ID_OUTPUT_FIELD_1 = "VALUES";protected static final String NAME_OUTPUT_FIELD_1 = "values";protected static final String ID_PARAMETER_1 = "SQL_PARAMETER_VALUES";protected static final String NAME_PARAMETER_1 = "sqlParameterValues";protected static final boolean USE_CACHE_DATA = false;protected static final Logger LOG = ger();protected Map configs = new LinkedHashMap();protected List outputFields;protected List parameters;protected String sqlParameterValues;protected List dataStore;public CellStringSplitToRows() {String sql = "select STAT_VALUE from _MONITOR_MAN where COND_ID=? and FLIGHT_DATE=?"+ " and TO_AIRPORT_ID=? and LD_AIRPORT_ID=? and FLIGHT_NO=? and FLIGHT_SEGMENT=?";addConfig(CN_DS_ID, "数据源ID", "执⾏SQL所对应的数据源ID", "", true);addConfig(CN_QUERY_SQL, "查询SQL", "获取待分隔字符串的查询SQL", sql, true);addConfig(CN_IGNORE_EMPTY_VALUE, "忽略空值", "分隔字符串后空⽩值是否忽略,需要忽略填"true"否则填"false"", "true",false);}/*** 添加⼀个配置项** @param name* 名称* @param alias* 别名* @param desc* 描述* @param defaultValue* 默认值* @param notNull* 是否允许为空*/private void addConfig(String name, String alias, String desc, String defaultValue,boolean notNull) {JavaQueryConfig p = new JavaQueryConfig();e(name);as(alias);c(desc);ue(defaultValue);Null(notNull);(name, p);}/*** 从保存的字符串中恢复配置信息** @param configs* 配置字符串*/public void loadConfigs(String configStr) {if (OrEmpty(configStr)) {return;}JSONObject obj = ring(configStr);(CN_DS_ID).setValue((CN_DS_ID) ? ing(CN_DS_ID) : null);(CN_QUERY_SQL).setValue((CN_QUERY_SQL) ? ing(CN_QUERY_SQL) : null);(CN_IGNORE_EMPTY_VALUE).setValue((CN_IGNORE_EMPTY_VALUE) ? ing(CN_IGNORE_EMPTY_VALUE) : null);}/*** 保存配置信息** @return 返回配置字符串*/public String saveConfigs() {JSONObject json = new JSONObject();for (JavaQueryConfig config : ()) {(e(), ue());}return ng();}/*** 获取Java查询需要的配置信息*/public List getConfigs() {return new ArrayList(());}/*** 设置配置信息** @param key* 名称* @param value* 配置值*/public void setConfigValue(String key, String value) {(key).setValue(value);}/*** 设置配置信息*/public void setConfigValues(Map configValues) {for (Entry config : et()) {(()).setValue(ue());}}/*** 根据配置信息初始化Java查询对象*/public void init() {initOutputFields();initParameters();}/*** 初始化输出字段*/protected void initOutputFields() {outputFields = new ArrayList();(new JavaQueryOutputField(ID_OUTPUT_FIELD_1, NAME_OUTPUT_FIELD_1, "values","", , ""));}/*** 初始化查询参数*/protected void initParameters() {parameters = new ArrayList();(new JavaQueryParameter(ID_PARAMETER_1, NAME_PARAMETER_1, "SQL参数值","执⾏查询SQL所需参数值,值与值之间英⽂逗号(,)分隔", , true));}/*** 返回参数对象*/public List getParameters() {return parameters;}/*** 返回Java查询的输出字段*/public List getOutputFields() {return outputFields;}/*** 设置参数值*/public void setParameterValue(String id, String value, String displayValue) {if (ID_PARAMETER_(id)) {sqlParameterValues = value == null ? null : eAll("^'|'$", "");dataStore = null; // reset}}/*** 返回总⾏数,返回_VALUE表⽰未知总⾏数*/public int getRowCount() {if (dataStore != null) {return ();} else {return _VALUE;}}/*** 关闭Java查询对象,关闭必要的资源*/public void close() {dataStore = null;}public synchronized List getValues() throws Exception {if (dataStore == null || !USE_CACHE_DATA) {Connection conn = null;PreparedStatement prep = null;ResultSet rs = null;try {String dsId = (CN_DS_ID).getValue();String sql = (CN_QUERY_SQL).getValue();boolean ignoreEmptyValue = !"false".equals((CN_IGNORE_EMPTY_VALUE).getValue());conn = tance().getConnection(dsId);prep = eStatement(sql);if (!OrEmpty(sqlParameterValues)) {int count = () - eAll("?", "").length();String[] values = (",");for (int i = 0, len = (count, ); i < len; i++) {ing(i + 1, values[i]);}}(sql + "; params=" + sqlParameterValues);rs = eQuery();List list = new ArrayList();while (()) {Reader reader = racterStream(1);BufferedReader br = new BufferedReader(reader);String line;while ((line = ne()) != null) {String[] items = (SPLIT_DELIMITER);for (String item : items) {if (ignoreEmptyValue && OrEmpty(item)) {continue;}(ignoreEmptyValue ? () : item);}}}dataStore = fiableList(list);} catch (Exception e) {(sage(), e);throw e;} finally {BObject(rs, prep, conn);}}return dataStore;}/*** 检测输⼊参数是否合法** @param from* @param count*/protected void assertGetDataParams(int from, int count) {if (from < 0 || count < 1) {throw new InvalidParameterException("parameter [from] must greater -1 and [count] must greater 0. current from="+ from + ", count=" + count);}}/*** 获取指定⾏的数据*/public GridData getGridData(int from, int count) {assertGetDataParams(from, count);List values = null;try {values = getValues();} catch (Exception e) {throw new RuntimeException(sage(), e);}List> datas = new ArrayList>();if (values != null && () > 0) {int toIndex = ((), from + count);for (String value : t(from, toIndex)) {List rowData = new ArrayList();CellData cellData = new CellData();ingValue(value);Double d = 0.0;try {d = ouble(value);} catch (NumberFormatException e) {}bleValue(Value());(cellData);(rowData);}}GridData grid = new GridData();List headers = new ArrayList();for (JavaQueryOutputField f : getOutputFields()) {(e());}ingHeaders(headers);a(datas);return grid;}}