00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CJNS_PREV_H_
00021 #define _CJNS_PREV_H_ 1
00022
00023 #include "CjNodeSelector.hh"
00024 #include <string>
00025 #include "JLOG.hh"
00026
00027 namespace jmitie {
00028 namespace corelib {
00029 class CjNS_prev: public CjNodeSelector {
00030 public:
00031 static std::string getName_static() { return "prev"; }
00032 virtual std::string getName() const { return getName_static(); }
00033 std::string getProperty(const std::string & prop) const { return getProperty_static(prop); }
00034 static std::string getProperty_static(const std::string & opt) {
00035 if(opt=="desc") return "Selects a node from a previous operation.";
00036 if(opt=="usage") return getProperty_static("desc") + "\n" +
00037 getName_static() + "={(rem,add),(bigD|smallD|old|new)}\n"\
00038 "Where\trem states that the choice should be between the two nodes most recently disconnected.\n"\
00039 "\tadd that the choice should be between the two nodes most recently connected.\n"\
00040 "\tbigD selects the node with the higher degree of the two.\n"\
00041 "\tsmallD selects the node with the smaller degree of the two.\n"\
00042 "\told selects the node with the lower node number of the two.\n"\
00043 "\tnew selects the node with the higher node number of the two.\n";
00044 getName_static() + "=M\tAlways selects node number M.\n";
00045 throw std::invalid_argument("CjNS_prev::getProperty_static(" + opt + "): Unknown property requested.");
00046 }
00047
00048 CjNS_prev(std::string args, const ctor_va_t & );
00049 virtual bool selectNode( select_arg_t &, unsigned int & node );
00050 virtual ~CjNS_prev() { JLOG(5, std::cout << "CjNS_prev being destroyed." << std::endl; ) };
00051
00052 protected:
00053 bool m_add_remove;
00054 enum prev_selection_type_t { NONE, BIGD, SMALLD, OLDER, NEWER };
00055 prev_selection_type_t m_selecta;
00056
00057 };
00058 }
00059 }
00060
00061 #endif // _CJNS_PREV_H_