?? nodeconnection.java
字號:
/*
* 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;
/**
* Connection is a class representing connection of two nodes in a case.
*/
public class NodeConnection implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* ID of the head node.
*/
private String m_HeadNodeID;
/**
* ID of the tail node.
*/
private String m_TailNodeID;
/**
* Contructs a Connection
*/
public NodeConnection() {
}
/**
* Constructs a Connection instance that represents a linkage between a head
* node and a tail node.
* @param a_HeadNodeID ID of the head node.
* @param a_TailNodeID ID of the tail node.
*/
public NodeConnection(String a_HeadNodeID, String a_TailNodeID) {
m_HeadNodeID = a_HeadNodeID;
m_TailNodeID = a_TailNodeID;
}
/**
* Returns ID of the head node of this connection.
* @return ID of the head node.
*/
public String getHeadNodeID() {
return m_HeadNodeID;
}
/**
* Sets ID of the head node of this connection.
* @param a_ID of the head node.
*/
public void setHeadNodeID(String a_ID) {
m_HeadNodeID = a_ID;
}
/**
* Returns ID of the tail node of this connection.
* @return ID of the tail node.
*/
public String getTailNodeID() {
return m_TailNodeID;
}
/**
* Sets ID of the tail node of this connection.
* @param a_ID of the tail node.
*/
public void setTailNodeID(String a_ID) {
m_TailNodeID = a_ID;
}
/**
* Checks if a specific node involves in the connection.
* @param a_NodeID ID of the node to be checked.
* @return true if the node involvoes in the connection; false otherwise.
*/
public boolean containNode(String a_NodeID) {
if (m_HeadNodeID.equals(a_NodeID) || m_TailNodeID.equals(a_NodeID))
return true;
else
return false;
}
/**
* Compares a specific Connection object with the current instance for
* equality.
* @param a_Connection the Connection to be compared for equality with this
* instance.
* @return true if the specified Conenction is equals to this Connection;
* false otherwise.
*/
public boolean equals(NodeConnection a_Connection) {
if (m_HeadNodeID.equals(a_Connection.getHeadNodeID())
&& m_TailNodeID.equals(a_Connection.getTailNodeID()))
return true;
else
return false;
}
/**
* Compares a specific Connection object with the current instance for reverse
* equality.
* @param a_Connection the Connection to be compared for equality with this
* instance.
* @return true if the head node of the specified Connection equals to
* the tail node of this Connection and the tail node of the specified
* Connection equals to the head node of this Connection; false otherwise.
*/
public boolean equalsReverse(NodeConnection a_Connection) {
if (m_HeadNodeID.equals(a_Connection.getTailNodeID())
&& m_TailNodeID.equals(a_Connection.getHeadNodeID()))
return true;
else
return false;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -