?? bicase.java
字號(hào):
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package eti.bi.alphaminer.vo;
import java.io.Serializable;
import java.util.Date;
import java.util.Vector;
/**
* $Author$
* $Date$
* $Revision$
*
* Case is an instance which represent a case in BIML format.
*/
public class BICase implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Different status of case
*/
public static final String DEACTIVATE = "deactivate";
public static final String ACTIVATE = "activate";
public static final String NEW = "new";
public static final String REMOVE_PENDING = "remove_pending";
/**
* Case details
*/
private String m_CaseName;
private String m_CaseID;
private String m_CreateDate;
private String m_CaseDescription;
private TaskNode m_TaskNode;
private NodeList m_ModelNodeList;
private NodeList m_OperatorNodeList;
private NodeList m_DataNodeList;
private Process m_Process;
private String m_Status;
private int m_AccessRight;
private int m_Version;
/**
* Constructs a case object
*/
public BICase() {
m_CreateDate = new Date().toString();
m_CaseDescription = new String();
m_TaskNode = new TaskNode();
m_ModelNodeList = new NodeList(NodeFactory.MODEL);
m_OperatorNodeList = new NodeList(NodeFactory.OPERATOR);
m_DataNodeList = new NodeList(NodeFactory.DATA);
m_Process = new Process();
m_Status = DEACTIVATE;
}
/**
* Constructs a case object
*/
public BICase(String CML, String PML, String MML, String DML) {
m_CreateDate = new Date().toString();
m_CaseDescription = new String();
m_TaskNode = new TaskNode();
m_ModelNodeList = new NodeList(NodeFactory.MODEL);
m_OperatorNodeList = new NodeList(NodeFactory.OPERATOR);
m_DataNodeList = new NodeList(NodeFactory.DATA);
m_Process = new Process();
m_Status = DEACTIVATE;
}
/**
* Obtains case information of the case instance.
* @return CaseInformation storing case information.
*/
public CaseInformation getCaseInfo() {
CaseInformation aCaseInfo = new CaseInformation(m_CaseID);
aCaseInfo.setCreateDate(m_CreateDate);
aCaseInfo.setCaseDescription(m_CaseDescription);
aCaseInfo.setStatus(m_Status);
if (m_TaskNode != null) {
aCaseInfo.setIndustry(m_TaskNode.getIndustry());
aCaseInfo.setProblemType(m_TaskNode.getProblemType());
aCaseInfo.setBusinessObjective(m_TaskNode.getBusinessObjective());
aCaseInfo.setDataMiningGoal(m_TaskNode.getDataMiningGoal());
aCaseInfo.setCompanyName(m_TaskNode.getCompanyName());
aCaseInfo.setDepartmentName(m_TaskNode.getDepartmentName());
aCaseInfo.setToolUsed(m_TaskNode.getToolUsed());
//<<21/02/2005 Mark Li: Add Case Name
aCaseInfo.setCaseName(m_TaskNode.getCaseName());
//21/02/2005 Mark Li: Add Case Name>>
// status should be obtained from task node
}
return aCaseInfo;
}
/**
* Gets case ID.
* @return ID of the case.
*/
public String getCaseID() {
return m_CaseID;
}
/**
* Sets case ID.
* @param a_CaseID new ID to be set for this case.
*/
public void setCaseID(String a_CaseID) {
m_CaseID = a_CaseID;
}
/**
* Sets case ID for nodes contained in the case.
* @param a_CaseID new ID to be set for the nodes.
*/
public void setCaseIDForNodes(String a_CaseID) {
// System.out.println("Update case id for nodes in the case");
m_TaskNode.setCaseID(a_CaseID);
Node[] nodes = getOperatorNodeListArray();
for (int i = 0; nodes != null && i < nodes.length; i++)
nodes[i].setCaseID(a_CaseID);
nodes = getModelNodeListArray();
for (int i = 0; nodes != null && i < nodes.length; i++)
nodes[i].setCaseID(a_CaseID);
nodes = getDataNodeListArray();
for (int i = 0; nodes != null && i < nodes.length; i++)
nodes[i].setCaseID(a_CaseID);
}
/**
* Gets name of the case.
* @return name of the case.
*/
public String getCaseName() {
return m_CaseName;
}
/**
* Sets name of the case.
* @param a_CaseName name to be set.
*/
public void setCaseName(String a_CaseName) {
m_CaseName = a_CaseName;
}
/**
* Gets description of the case.
* @return description of the case.
*/
public String getCaseDescription() {
return m_CaseDescription;
}
/**
* Sets description of the case.
* @param a_Description description to be set.
*/
public void setCaseDescription(String a_Description) {
m_CaseDescription = a_Description;
}
/**
* Gets creation date of the case.
* @return creation date of the case.
*/
public String getCreateDate() {
return m_CreateDate;
}
/**
* Sets creation date of the case.
* @param a_CreateDate creation date to be set.
*/
public void setCreateDate(String a_CreateDate) {
m_CreateDate = a_CreateDate;
}
/**
* Gets TaskNode of the case.
* @return TaskNode of the case.
*/
public TaskNode getTaskNode() {
return m_TaskNode;
}
/**
* Sets TaskNode of the case.
* @param a_Node Task node to be set.
*/
public void setTaskNode(TaskNode a_Node) {
m_TaskNode = a_Node;
}
/**
* Gets a Node contained in the case.
* @param a_NodeID ID of the node to be obtained.
* @return Node if a_NodeID is a valid node ID; null otherwise.
*/
public Node getNode(String a_NodeID) {
Node node = getTaskNode();
if (node != null && node.getNodeID() != null) {
if( node.getNodeID().equals(a_NodeID))
return node;
}
node = getModelNode(a_NodeID);
if (node != null)
return node;
node = getOperatorNode(a_NodeID);
if (node != null)
return node;
node = getDataNode(a_NodeID);
return node;
}
/**
* Gets a Node contained in the case.
* @param a_NodeType type of the node to be obtained.
* @param a_NodeID ID of the node to be obtained.
* @return Node if node exists in the case; null otherwise.
*/
public Node getNode(int a_NodeType, String a_NodeID) {
if (a_NodeType == NodeFactory.TASK)
return getTaskNode();
else {
if (a_NodeID == null) {
System.err.println("In Case:getNode: node id is null");
return null;
}
if (a_NodeType == NodeFactory.MODEL)
return getModelNode(a_NodeID);
else if (a_NodeType == NodeFactory.OPERATOR)
return getOperatorNode(a_NodeID);
else if (a_NodeType == NodeFactory.DATA)
return getDataNode(a_NodeID);
else {
System.err.println("In Case:getNode: invalid node type");
return null;
}
}
}
/**
* Set a Node in the case.
* @param a_Node Node to be set.
*/
public void setNode(INode a_Node) {
if (a_Node instanceof TaskNode)
setTaskNode((TaskNode) a_Node);
else if (a_Node instanceof ModelNode)
setModelNode((ModelNode) a_Node);
else if (a_Node instanceof OperatorNode)
setOperatorNode((OperatorNode) a_Node);
else if (a_Node instanceof DataNode)
setDataNode((DataNode) a_Node);
}
/**
* Removes a Node from the case.
* @param a_NodeType type of the node to be removed.
* @param a_NodeID ID of the node to be removed.
*/
public void removeNode(int a_NodeType, String a_NodeID) {
if (a_NodeType == NodeFactory.TASK)
removeTaskNode();
else {
if (a_NodeID == null)
System.err.println("In Case:removeNode: node id is null");
if (a_NodeType == NodeFactory.MODEL)
removeModelNode(a_NodeID);
else if (a_NodeType == NodeFactory.OPERATOR)
removeOperatorNode(a_NodeID);
else if (a_NodeType == NodeFactory.DATA)
removeDataNode(a_NodeID);
}
m_Process.removeConnectionOfNode(a_NodeID);
}
/**
* Gets a NodeList of data nodes.
* @return NodeList of data nodes.
*/
public NodeList getDataNodeList() {
return m_DataNodeList;
}
/**
* Sets the data node NodeList.
* @param a_NodeList data node NodeList to be set.
*/
public void setDataNodeList(NodeList a_NodeList) {
m_DataNodeList = a_NodeList;
}
/**
* Gets an array of data nodes.
* @return array of Nodes (DataNode).
*/
public Node[] getDataNodeListArray() {
return m_DataNodeList.getNodeListArray();
}
/**
* Gets the size of data node NodeList.
* @return size of NodeList storing data nodes.
*/
public int getDataNodeListSize() {
return m_ModelNodeList.getNodeListSize();
}
/**
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -