package com.smtaiserver.smtaiserver.javaai.duckdb;
|
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Map.Entry;
|
|
import com.smtaiserver.smtaiserver.javaai.ast.ASTDimFilter;
|
import com.smtaiserver.smtaiserver.javaai.ast.ASTTimeRange;
|
import com.smtaiserver.smtaiserver.javaai.metrics.base.SMTDuckTimeGroupName;
|
|
|
public class DuckCubeRecs
|
{
|
public enum DuckCubeRecsType
|
{
|
VALUE,
|
SUMMARY,
|
RECORD
|
}
|
|
public static class DuckCubeColTitle
|
{
|
public String _title;
|
public boolean _isGroup;
|
public boolean _isCount;
|
|
public DuckCubeColTitle(String title, boolean isGroup, boolean isCount)
|
{
|
_title = title;
|
_isGroup = isGroup;
|
_isCount = isCount;
|
}
|
}
|
|
public boolean _isRawRS = false;
|
public DuckCubeRecsType _recsType = DuckCubeRecsType.VALUE;
|
public String _title;
|
public String _chartUnit;
|
public String _chartTitle;
|
public String _posXName;
|
public String _posYName;
|
public String _devKeyName;
|
public Map<String, DuckCubeColTitle> _mapCol2Title = new HashMap<>();
|
public int _colKeyCount = 0;
|
public List<String> _dimNames = new ArrayList<>();
|
public List<ASTDimFilter> _listDimFilter = null;
|
public String _chartType = null;
|
public ASTTimeRange _timeRange = null;
|
public String _tableName;
|
public String[] _orderCol;
|
public List<SMTDuckTimeGroupName> _listGroupNameInfo;
|
|
|
public DuckCubeRecs cloneCubeRecs()
|
{
|
DuckCubeRecs newCubeRecs = new DuckCubeRecs();
|
newCubeRecs._recsType = this._recsType;
|
newCubeRecs._title = this._title;
|
newCubeRecs._posXName = _posXName;
|
newCubeRecs._posYName = _posYName;
|
newCubeRecs._devKeyName = _devKeyName;
|
newCubeRecs._colKeyCount = _colKeyCount;
|
newCubeRecs._isRawRS = _isRawRS;
|
newCubeRecs._chartType = this._chartType;
|
newCubeRecs._title = this._title;
|
newCubeRecs._chartTitle = this._chartTitle;
|
newCubeRecs._chartUnit = this._chartUnit;
|
newCubeRecs._orderCol = this._orderCol;
|
newCubeRecs._listGroupNameInfo = _listGroupNameInfo;
|
|
if(_timeRange != null)
|
newCubeRecs._timeRange = _timeRange.cloneTimeRange();
|
|
for(String dimName : _dimNames)
|
{
|
newCubeRecs._dimNames.add(dimName);
|
}
|
|
for(Entry<String, DuckCubeColTitle> entry : _mapCol2Title.entrySet())
|
{
|
newCubeRecs._mapCol2Title.put(entry.getKey(), entry.getValue());
|
}
|
|
return newCubeRecs;
|
}
|
|
public boolean isSameStartTime(Date checkTime, Date[] r_curTime)
|
{
|
Date curTime = _timeRange._startTime;
|
|
if(r_curTime != null)
|
r_curTime[0] = curTime;
|
|
if(checkTime == null || curTime == null)
|
{
|
return (checkTime == null && curTime == null);
|
}
|
else
|
{
|
return checkTime.equals(curTime);
|
}
|
}
|
}
|