示例#1
0
/////////////////////////////////////////////////
// Cyc-Base
int TCycBs::AddVNm(const TStr& VNm){
  int VId;
  if (VNmToVrtxH.IsKey(VNm.CStr(), VId)){
    return VId;
  } else {
    VId=VNmToVrtxH.AddKey(VNm);
    TCycVrtx& Vrtx=VNmToVrtxH[VId];
    Vrtx.PutVId(VId);
    // set flags based on vertex-name string
    if (VNm.IsPrefix("~")){
      Vrtx.SetFlag(cvfBackLink);
    } else
    if (VNm.IsPrefix("#$")&&(!VNm.IsChIn(' '))){
      Vrtx.SetFlag(cvfCycL);
      if (VNm.Len()>2){
        char Ch=VNm[2];
        if (('a'<=Ch)&&(Ch<='z')){
          Vrtx.SetFlag(cvfCycLPred);
        } else {
          Vrtx.SetFlag(cvfCycLConst);
        }
      }
    } else
    if (VNm.IsPrefix("(#$")){
      Vrtx.SetFlag(cvfCycL);
      Vrtx.SetFlag(cvfCycLExpr);
    } else {
      if (VNm.IsFlt()){
        Vrtx.SetFlag(cvfNum);
      } else {
        Vrtx.SetFlag(cvfStr);
      }
    }
    return VId;
  }
}
示例#2
0
double TSAppSrvFun::GetFldFlt(const TStrKdV& FldNmValPrV, const TStr& FldNm, const double& DefFlt) {
	if (!IsFldNm(FldNmValPrV, FldNm)) { return DefFlt; }
	TStr IntStr = GetFldVal(FldNmValPrV, FldNm, "");
	EAssertR(IntStr.IsFlt(), "Parameter '" + FldNm + "' not a number");
	return IntStr.GetFlt();
}
示例#3
0
double TFtrGenNumeric::GetFlt(const TStr& Str) const {
    double Val = 0.0;
    if (!Str.IsFlt(Val)) { 
        TExcept::Throw(TStr::Fmt("Number expected  but '%s' found!", Str.CStr())); }
    return Val;
}