00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CJLS_DEGREE_H_
00021 #define _CJLS_DEGREE_H_ 1
00022
00023 #include <string>
00024 #include "CjLinkSelector.hh"
00025
00026 namespace jmitie {
00027 namespace corelib {
00028
00029 class CjLS_degree : public CjLinkSelector {
00030 public:
00031
00032 static std::string getName_static() { return "degree"; }
00033 virtual std::string getName() const { return getName_static(); }
00034 std::string getProperty(const std::string & prop) const { return getProperty_static(prop); }
00035 static std::string getProperty_static(const std::string & opt) {
00036 if(opt=="desc") return "Selects a link or node-pair based on the degree of the nodes.";
00037 if(opt=="usage") return getProperty_static("desc") + "\n" +
00038 "(diff|add)\tSpecify whether the difference or sum of the degrees should be put into the wheel for selection.\n" \
00039 "[exp=float]\tThe sum or difference is taken to this power before it is placed in the selection wheel.\n" \
00040 "[dupe_ok]\tIf specified a node pairs which are already connected are included in the node-pair selection(only applies when adding links).\n";
00041 throw std::invalid_argument("CjLS_degree::getProperty_static(" + opt + "): Unknown property requested.");
00042 }
00043
00044 CjLS_degree(std::string args, const ctor_va_t & va );
00045
00046 virtual bool selectLink( select_arg_t &, unsigned int & from, unsigned int & to );
00047 virtual ~CjLS_degree() {};
00048
00049 protected:
00050 bool m_add_remove;
00051 bool m_diff_add;
00052 bool m_exp_set;
00053 double m_deg_exp;
00054 bool m_dupe_link_ok;
00055
00056 private:
00057
00058 };
00059 }
00060 }
00061
00062 #endif // _CJLS_DEGREE_H_