예제 #1
0
void TarjanHD::run()
{
  _T.clear();

  NodeNodeMap mapToOrgG(_orgG, lemon::INVALID);
  for (NodeIt v(_orgG); v != lemon::INVALID; ++v)
  {
    mapToOrgG[v] = v;
  }
  
  ArcList arcs;
  for (ArcIt a(_orgG); a != lemon::INVALID; ++a)
  {
    arcs.push_back(a);
  }

  // sort by weight
  arcs.sort(Comparison(_orgW));

  BoolArcMap arcFilter(_orgG, true);
  BoolNodeMap nodeFilter(_orgG, true);
  NodeNodeMap G2T(_orgG, lemon::INVALID);
 
  SubDigraph subG(_orgG, nodeFilter, arcFilter);
  
  _root = hd(_orgG, _orgW, subG, mapToOrgG, G2T, arcs, 0);
  fixTree(_root);
}
예제 #2
0
 Optional<SchemaError> validate(ValidationContext&,
                                const dynamic& value) const override {
   if (length_ < 0) {
     return none;
   }
   if (value.type() != type_) {
     return none;
   }
   if (!Comparison()(length_, value.size())) {
     return makeError("different length string/array/object", value);
   }
   return none;
 }
예제 #3
0
const double Parser::Expression (const bool get)  // AND and OR
  {
  double left = Comparison (get);
  while (true)
    {
    switch (type_)
      {
      case AND: 
            {
            double d = Comparison (true);   // don't want short-circuit evaluation
            left = (left != 0.0) && (d != 0.0); 
            }
          break;
      case OR:  
            {
            double d = Comparison (true);   // don't want short-circuit evaluation
            left = (left != 0.0) || (d != 0.0); 
            }
          break;
      default:    return left;
      } // end of switch on type
    }   // end of loop
  } // end of Parser::Expression
예제 #4
0
파일: fuli2.c 프로젝트: crown999/crown999
void main(){
	int a;
	printf("1、用复利计算\n");
	printf("2、用单利计算\n");
	printf("3、输出复利计算、单利计算的结果\n");
	printf("4、输入终止时金额求存款\n");
	printf("\n请输入你的选择:");
	scanf("%d",&a);
	if(a==1)
		Compounding();
	else if(a==2)
		Simple_Interested();
	else if(a==3)
		Comparison();
	else if(a==4)
		Count_Deposit();
}
예제 #5
0
void main(){
    char t;
	int a;
	menu();
loop:
    printf("\n请输入你的选择:");
	if(scanf("%d",&a)==1){
    switch(a)
    {
    case 0:
         exit(0);
		 break;
    case 1:
        system("cls");
        t=getchar();
        Compounding();
        break;
    case 2:
        system("cls");
        t=getchar();
        Simple_Interested();
        break;
    case 3:
        system("cls");
        t=getchar();
        Comparison();
        break;
    case 4:
        system("cls");
        t=getchar();
        Count_Deposit();
        break;
    case 5:
        system("cls");
        t=getchar();
        Count_Year();
        break;
    case 6:
        system("cls");
        t=getchar();
        Count_Interest();
        break;
    case 7:
        system("cls");
        t=getchar();
        Count_Money();
        break;
    case 8:
        system("cls");
        t=getchar();
        Count_Refunt();
        break;
    default:
        printf("输入有误!请重新输入!(目前功能选项只有1~8)\n");
        goto loop;
    }    
	}
	else{
		system("cls");
        t=getchar();
		printf("\n输入有误!请重新输入!(目前功能选项只有1~8)\n\n");
        main();
	}
}
예제 #6
0
Comparison operator ! (const Attribute &attr)
{
    return Comparison(attr, CSSM_DB_EQUAL, uint32(CSSM_FALSE));
}