00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CJNS_D_
00021 #define _CJNS_D_ 1
00022
00023 #include "CjNodeSelector.hh"
00024 #include <string>
00025 #include "JLOG.hh"
00026
00027 namespace jmitie {
00028 namespace corelib {
00029 class CjNS_D: public CjNodeSelector {
00030 public:
00031 static std::string getName_static() { return "D"; }
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 "Select a node based on its out-degree.";
00036 if(opt=="usage") return getProperty_static("desc") + "\n" \
00037 "[exp=float]\tThe optional exponent to which to raise the node outdegree value.\n"\
00038 "[dupe_ok]\tIf specified, and if this is the second selector in a process, the selector may return a node which is already connected to this node.\n";
00039 throw std::invalid_argument("CjNS_D::getProperty_static(" + opt + "): Unknown property requested.");
00040 }
00041
00042 CjNS_D(std::string args, const ctor_va_t &);
00043 virtual bool selectNode( select_arg_t &, unsigned int & node );
00044 virtual ~CjNS_D() { JLOG(5, std::cout << "CjNS_D being destroyed." << std::endl; ) };
00045
00046 protected:
00047 bool m_dupe_link_ok;
00048 double m_deg_exp;
00049 bool m_exp_set;
00050
00051 };
00052 }
00053 }
00054
00055 #endif // _CJNS_D_