Esempio n. 1
0
void
Control::Substitute(map<string,string>* __mapping){
switch(GetControlKind()){
   case ADaAn_FOR      :
            if(__mapping->find(GetCounter()) != __mapping->end())
               SetCounterName(__mapping->operator[](GetCounter()));
            GetForLowerBound()->Substitute(__mapping);
            GetForUpperBound()->Substitute(__mapping);
            return;
   case ADaAn_WHILE   :
            if(__mapping->find(GetCounter()) != __mapping->end())
               SetCounterName(__mapping->operator[](GetCounter()));
            GetCondition()->Substitute(__mapping);
            return;
   case ADaAn_IF      :
            GetCondition()->Substitute(__mapping);
            return;
   case ADaAn_IF_ELSE   :
            GetCondition()->Substitute(__mapping);
            return;
   }

cerr<<"Control::Rename, Fatal error(unhandled operator)";
throw(UNHANDLED_CASE);
exit(EXIT_FAILURE);
}
bool TBWidgetSkinConditionContext::GetCondition(TBSkinCondition::TARGET target, const TBSkinCondition::CONDITION_INFO &info)
{
	switch (target)
	{
	case TBSkinCondition::TARGET_THIS:
		return GetCondition(m_widget, info);
	case TBSkinCondition::TARGET_PARENT:
		return m_widget->GetParent() && GetCondition(m_widget->GetParent(), info);
	case TBSkinCondition::TARGET_ANCESTORS:
		{
			TBWidget *widget = m_widget->GetParent();
			while (widget)
			{
				if (GetCondition(widget, info))
					return true;
				widget = widget->GetParent();
			}
		}
	case TBSkinCondition::TARGET_PREV_SIBLING:
		return m_widget->GetPrev() && GetCondition(m_widget->GetPrev(), info);
	case TBSkinCondition::TARGET_NEXT_SIBLING:
		return m_widget->GetNext() && GetCondition(m_widget->GetNext(), info);
	}
	return false;
}
Esempio n. 3
0
Condition*
Control::GetDomainConstraints(int stmt)
{
Condition*   result;
if((IsLoop( ) || IsIf( )))
   {
   if( (stmt >= first_assign) && (stmt <= last_assign))
      {
      if(IsForLoop( ))
         {
         Inequation* ineq1=new Inequation ( new Expression(GetLoopCounter( )),FADA_GREATER_EQ,GetForLowerBound( ));
         Inequation* ineq2=new Inequation ( new Expression(GetLoopCounter( )),FADA_LESS_EQ,GetForUpperBound( ));
         return new Condition( new Condition(ineq1), FADA_AND , new Condition(ineq2));
         }
      else
         return GetCondition( );
      }
   else
      return new Condition(new Inequation (true));
   }
if(IsIfElse( ))
   {
   if( (stmt >= first_assign) && (stmt <= last_assign))
      return GetCondition( );
   else
      {
      if( (stmt >= else_first_assign) && (stmt <= else_last_assign))
         return GetCondition( )->FastNegation( );
      else
         return new Condition(new Inequation (true));
      }
   }
}
Esempio n. 4
0
string
Control::Generate_C_Code(void)
{

string result;

ostringstream   s;

switch(GetControlKind( ))
   {
   case ADaAn_FOR      :
         result= "for ( "+GetLoopCounter( );
         result+= " = "+GetForLowerBound( )->Generate_C_Code();
         result+= "; "+GetLoopCounter()+" <= "+GetForUpperBound()->Generate_C_Code();
         result+= "; ++" + GetLoopCounter() +")";
         break;
   case ADaAn_WHILE   :result = "while("+GetCondition( )->Generate_C_Code()+")"; break;
   case ADaAn_IF      :result = "if("+GetCondition( )->Generate_C_Code()+")"; break;
   case ADaAn_IF_ELSE   :result = "if/*then else*/("+GetCondition( )->Generate_C_Code()+")"; break;
   default: cerr<<endl<<"Fatal error, Control::Print_str(), unhandled operator ";
      throw(UNHANDLED_CASE);
      exit(EXIT_FAILURE);
   }
return result;

}
Esempio n. 5
0
bool ChessMove::IsValidMoveRook(const ChessBoard& board) const{
    if (endX==startX){
        int deltaY = 1;
        if (startY > endY){deltaY = -1;}
        for (int i = startY+deltaY; GetCondition(i, startY, endY); i+=deltaY)
            if (board.GetPiece(startX, i)) return false;
        return true;
    } else if (endY==startY){
        int deltaX = 1;
        if (startX > endX){deltaX = -1;}
        for (int i = startX+deltaX; GetCondition(i, startX, endX); i+=deltaX)
            if (board.GetPiece(i, startY)) return false;
        return true;
    }
    return false;
}
void BFBackupProgressDlg::OnQuestion (wxCommandEvent& rEvent)
{
    // ask questioin
    BFMessageDlg dlg(BF_MSGDLG_BACKUP_QUESTION,
                     rEvent.GetString() + _("\n\nHow to continue?"),
                     wxEmptyString,
                     BFMessageDlg::GetDlgType((BFMessageType)rEvent.GetExtraLong()));

    BF_StopLevel answer = BFDO_ASK;

    switch(dlg.ShowModal())
    {
        case BF_MSGDLG_ID_STOPPRJ:
            answer = BFDO_STOPPRJ;
            break;

        case BF_MSGDLG_ID_STOPTSK:
            answer = BFDO_STOPTSK;
            break;

        case BF_MSGDLG_ID_IGNORE:
            answer = BFDO_IGNORE;
            break;
    };

    // set answer
    BFThread_BackupRunner::CurrentlyRunning()->SetUsersStopAnswer(answer);

    // resume the asking thread
    wxMutexLocker lock( *pMutex_ );
    GetCondition()->Signal();
}
Esempio n. 7
0
void pgRule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);
		wxString def = GetFormattedDefinition();
		if (!def.IsEmpty())
		{
			int doPos = def.Find(wxT(" DO INSTEAD "));
			if (doPos > 0)
				def = def.Mid(doPos + 12).Strip(wxString::both);
			else
			{
				doPos = def.Find(wxT(" DO "));
				if (doPos > 0)
					def = def.Mid(doPos + 4).Strip(wxString::both);
			}
		}

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Event"), GetEvent());
		properties->AppendItem(_("Condition"), GetCondition());
		properties->AppendYesNoItem(_("Do instead?"), GetDoInstead());
		properties->AppendItem(_("Definition"), firstLineOnly(def));
		if (this->GetDatabase()->connection()->BackendMinimumVersion(8, 3))
			properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System rule?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Esempio n. 8
0
//**************************************************
wxRealPoint wxSFBotLineShape::GetSrcPoint()
{
	wxRealPoint pt1, pt2;
	
	wxSFShapeBase* pSrcShape = GetShapeManager()->FindShape(m_nSrcShapeId);
	
	if( pSrcShape && !m_lstPoints.IsEmpty() )
	{
		RealPointList::compatibility_iterator node = m_lstPoints.GetFirst();
		if( node )
		{	
			pt1 = *node->GetData();
			if(pSrcShape->IsKindOf(CLASSINFO(wxSFIfShape)))
			{
				wxSFIfShape *ifShape = (wxSFIfShape *)pSrcShape;
				if(GetCondition() == 1)
					return ifShape->GetBorderPoint(true);
				else
					return ifShape->GetBorderPoint(false);
			}
			else
				return wxRealPoint(pSrcShape->GetBoundingBox().x + pSrcShape->GetBoundingBox().GetWidth() / 2, pSrcShape->GetBoundingBox().GetBottom());
		}
	}
	else
	{
		if( m_nMode != modeUNDERCONSTRUCTION )
			GetDirectLine( pt1, pt2 );
		else
			pt1 = wxRealPoint(pSrcShape->GetBoundingBox().x + pSrcShape->GetBoundingBox().GetWidth() / 2, pSrcShape->GetBoundingBox().GetBottom());
		return pt1;
	}

	return wxRealPoint();
}
Esempio n. 9
0
//-----------------------------------------------------------------------------
// Purpose: Touch function
//-----------------------------------------------------------------------------
bool CTFBaseDMPowerup::MyTouch( CBasePlayer *pPlayer )
{
	bool bSuccess = false;

	CTFPlayer *pTFPlayer = dynamic_cast<CTFPlayer*>( pPlayer );
	if ( pTFPlayer && ValidTouch( pPlayer ) )
	{
		// Add the condition and duration from derived classes
		pTFPlayer->m_Shared.AddCond( GetCondition(), GetEffectDuration() );

		// Give full health
		SetHealth( GetMaxHealth() );

		CSingleUserRecipientFilter user( pPlayer );
		user.MakeReliable();

		UserMessageBegin( user, "ItemPickup" );
			WRITE_STRING( GetClassname() );
		MessageEnd();

		pPlayer->EmitSound( STRING( m_strPickupSound ) );

		bSuccess = true;
	}

	return bSuccess;
}
Esempio n. 10
0
float	CCustomOutfit::HitThruArmour(float hit_power, s16 element, float AP)
{
	float BoneArmour = m_boneProtection->getBoneArmour(element)*GetCondition()*(1-AP);	
	float NewHitPower = hit_power - BoneArmour;
	if (NewHitPower < hit_power*m_boneProtection->m_fHitFrac) return hit_power*m_boneProtection->m_fHitFrac;
	return NewHitPower;
};
Esempio n. 11
0
float CCustomOutfit::GetPowerLoss() 
{
	if (m_fPowerLoss<1 && GetCondition() <= 0)
	{
		return 1.0f;			
	};
	return m_fPowerLoss;
};
Esempio n. 12
0
string
Edge::ToGraphViz(long unsigned int rank,vector<string> loops, long unsigned int write,GraphPrinterOptions op){
ostringstream result;
result<< op.sigma<<"( "+GetVariableName() 
      +GetIndex()->Generate_C_Code()+")   =   "<<PrintOperation(write,GetSigma()->GetIndex(),op);
result<<"\\n  IF \\n "<<GetCondition()->Generate_C_Code();
return result.str();
}
Esempio n. 13
0
string
Edge::Print_str(std::string indent)   {
ostringstream s;
s<<""<<indent<<" Var ="<<variable;
s<<""<<indent<<" Index="<<indent<<GetIndex()->Print_str();
s<<""<<indent<<" Validity ="<<indent<<GetCondition()->Print_str();
s<<""<<indent<<" Sigma ="<<indent<<GetSigma()->Print_str();
return s.str();
};
Esempio n. 14
0
float CWeapon::GetConditionMisfireProbability() const
{
// modified by Peacemaker [17.10.08]
//	if(GetCondition() > 0.95f) 
//		return 0.0f;
	if(GetCondition() > misfireStartCondition) 
		return 0.0f;
	if(GetCondition() < misfireEndCondition) 
		return misfireEndProbability;
//	float mis = misfireProbability+powf(1.f-GetCondition(), 3.f)*misfireConditionK;
	float mis = misfireStartProbability + (
		(misfireStartCondition - GetCondition()) *				// condition goes from 1.f to 0.f
		(misfireEndProbability - misfireStartProbability) /		// probability goes from 0.f to 1.f
		((misfireStartCondition == misfireEndCondition) ?		// !!!say "No" to devision by zero
			misfireStartCondition : 
			(misfireStartCondition - misfireEndCondition))
										  );
	clamp(mis,0.0f,0.99f);
	return mis;
}
Esempio n. 15
0
float CCustomOutfit::HitThroughArmor(float hit_power, s16 element, float ap, bool& add_wound, ALife::EHitType hit_type)
{
	float NewHitPower = hit_power;
	if(hit_type == ALife::eHitTypeFireWound)
	{
		float ba = GetBoneArmor(element);
		if(ba<0.0f)
			return NewHitPower;

		float BoneArmor = ba*GetCondition();
		if(/*!fis_zero(ba, EPS) && */(ap > BoneArmor))
		{
			//пуля пробила бронь
			if(!IsGameTypeSingle())
			{
				float hit_fraction = (ap - BoneArmor) / ap;
				if(hit_fraction < m_boneProtection->m_fHitFracActor)
					hit_fraction = m_boneProtection->m_fHitFracActor;

				NewHitPower *= hit_fraction;
				NewHitPower *= m_boneProtection->getBoneProtection(element);
			}

			VERIFY(NewHitPower>=0.0f);
		}
		else
		{
			//пуля НЕ пробила бронь
			NewHitPower *= m_boneProtection->m_fHitFracActor;
			add_wound = false; 	//раны нет
		}
	}
	else
	{
		float one = 0.1f;
		if(hit_type == ALife::eHitTypeStrike || 
		   hit_type == ALife::eHitTypeWound || 
		   hit_type == ALife::eHitTypeWound_2 || 
		   hit_type == ALife::eHitTypeExplosion)
		{
			one = 1.0f;
		}
		float protect = GetDefHitTypeProtection(hit_type);
		NewHitPower -= protect * one;

		if(NewHitPower < 0.f)
			NewHitPower = 0.f;
	}
	//увеличить изношенность костюма
	Hit(hit_power, hit_type);

	return NewHitPower;
}
Esempio n. 16
0
Condition*
Control::GetRegularDomain(void){
Condition* result;
if(IsIf() || IsIfElse() || IsWhileLoop())
   {
   if(IsWhileLoop()){
      Inequation* ineq=new Inequation(new Expression(GetCounter()),FADA_GREATER_EQ,new Expression(1));
      Condition* count_ge_0 = new Condition (ineq);
      result=new Condition(count_ge_0,FADA_AND,GetCondition());
      return result;
      }
   return GetCondition();
   }
if(IsForLoop()){
   Inequation* ineq1=new Inequation ( new Expression(GetLoopCounter( )),FADA_GREATER_EQ,GetForLowerBound( ));
   Inequation* ineq2=new Inequation ( new Expression(GetLoopCounter( )),FADA_LESS_EQ,GetForUpperBound( ));
   result = new Condition( new Condition(ineq1), FADA_AND , new Condition(ineq2));
   return result;
   }
cout<<"\nControl::GetRegularDomain(void) .... inappropriate case \n";
throw(10);
}
int wmain()
{
    // File dialog drag and drop feature requires OLE
    HRESULT hr = OleInitialize(NULL);
    if (SUCCEEDED(hr))
    {
        ISearchFolderItemFactory *pSearchFolderItemFactory;
        hr = CoCreateInstance(CLSID_SearchFolderItemFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pSearchFolderItemFactory));
        if (SUCCEEDED(hr))
        {
            IShellItemArray *psiaScope;
            hr = CreateScope(&psiaScope);
            if (SUCCEEDED(hr))
            {
                hr = pSearchFolderItemFactory->SetScope(psiaScope);
                if (SUCCEEDED(hr))
                {
                    // Sets the display name of the search
                    hr = pSearchFolderItemFactory->SetDisplayName(L"Sample Query");
                    if (SUCCEEDED(hr))
                    {
                        ICondition* pCondition;
                        hr = GetCondition(&pCondition);
                        if (SUCCEEDED(hr))
                        {
                            // Sets the condition for pSearchFolderItemFactory
                            hr = pSearchFolderItemFactory->SetCondition(pCondition);
                            if (SUCCEEDED(hr))
                            {
                                // This retrieves an IShellItem of the search.  It is a virtual child of the desktop.
                                IShellItem* pShellItemSearch;
                                hr = pSearchFolderItemFactory->GetShellItem(IID_PPV_ARGS(&pShellItemSearch));
                                if (SUCCEEDED(hr))
                                {
                                    OpenCommonFileDialogTo(pShellItemSearch);
                                    pShellItemSearch->Release();
                                }
                            }
                            pCondition->Release();
                        }
                    }
                }
                psiaScope->Release();
            }
            pSearchFolderItemFactory->Release();
        }
        OleUninitialize();
    }
    return 0;
}
Esempio n. 18
0
void CWeapon::net_Export(NET_Packet& P)
{
	inherited::net_Export	(P);

	P.w_float_q8			(GetCondition(),0.0f,1.0f);


	u8 need_upd				= IsUpdating() ? 1 : 0;
	P.w_u8					(need_upd);
	P.w_u16					(u16(iAmmoElapsed));
	P.w_u8					(m_flagsAddOnState);
	P.w_u8					(m_ammoType);
	P.w_u8					((u8)GetState());
	P.w_u8					((u8)IsZoomed());
}
Esempio n. 19
0
//**************************************************
//*****************Figure LINE**********************
//**************************************************
void wxSFBotLineShape::GetDirectLine(wxRealPoint& src, wxRealPoint& trg)
{
	wxSFShapeBase* pSrcShape = GetShapeManager()->FindShape(m_nSrcShapeId);
	wxSFShapeBase* pTrgShape = GetShapeManager()->FindShape(m_nTrgShapeId);

	if(pSrcShape && pTrgShape)
	{
		wxRealPoint trgCenter = GetModTrgPoint();
		wxRealPoint srcCenter = GetModSrcPoint();

		if( (pSrcShape->GetParent() == pTrgShape) || (pTrgShape->GetParent() == pSrcShape) )
		{
			wxRect trgBB = pTrgShape->GetBoundingBox();
			wxRect srcBB = pSrcShape->GetBoundingBox();

			if( trgBB.Contains((int)srcCenter.x, (int)srcCenter.y) )
			{
				src = wxRealPoint(srcCenter.x, srcBB.GetTop());
				trg = wxRealPoint(trgBB.x + trgBB.GetWidth() / 2, trgBB.GetTop());
				return;
			}
			else if( srcBB.Contains((int)trgCenter.x, (int)trgCenter.y) )
			{
				src = wxRealPoint(srcCenter.x, srcBB.GetTop());
				trg = wxRealPoint(trgBB.x + trgBB.GetWidth() / 2, trgBB.GetTop());
				return;
			}
		}
		
		if(pSrcShape->IsKindOf(CLASSINFO(wxSFIfShape)))
		{
			wxSFIfShape *ifShape = (wxSFIfShape *)pSrcShape;
			if(GetCondition() == 1)
				src = ifShape->GetBorderPoint(true);
			else
				src = ifShape->GetBorderPoint(false);
		}
		else
			src = wxRealPoint(pSrcShape->GetBoundingBox().x + pSrcShape->GetBoundingBox().GetWidth() / 2, pSrcShape->GetBoundingBox().GetBottom());

		if(pTrgShape->IsKindOf(CLASSINFO(wxSFIfShape)))
			trg = wxRealPoint(trgCenter.x, pTrgShape->GetBoundingBox().GetTop());
		else
			trg = wxRealPoint(pTrgShape->GetBoundingBox().x + pTrgShape->GetBoundingBox().GetWidth() / 2, pTrgShape->GetBoundingBox().GetTop());
	}	
}
Esempio n. 20
0
Condition* DLGImporter::GetTransitionTrigger(unsigned int index) const
{
	if (index >= TransitionTriggersCount) {
		return NULL;
	}
	str->Seek( TransitionTriggersOffset + ( index * 8 ), GEM_STREAM_START );
	ieDword Offset, Length;
	str->ReadDword( &Offset );
	str->ReadDword( &Length );
	str->Seek( Offset, GEM_STREAM_START );
	char* string = ( char* ) malloc( Length + 1 );
	str->Read( string, Length );
	string[Length] = 0;
	Condition *condition = GetCondition(string);
	free( string );
	return condition;
}
Esempio n. 21
0
void
Control::ReferencedScalars(set<string>* scalars)
{
if(IsIf( ) || IsIfElse( ) || IsWhileLoop( )){
   GetCondition( )->ReferencedScalars( scalars );
   return ;
   }
if(IsForLoop( ))
   {
   GetForLowerBound( )->ReferencedScalars( scalars );
   GetForUpperBound( )->ReferencedScalars( scalars );
   return;
   }

cerr<<endl<<"Control::ReferencedScalars(), fatal error, unhandled control structure"<<endl;
throw(UNHANDLED_CASE);
exit(EXIT_FAILURE);
}
Esempio n. 22
0
bool ChessMove::IsValidCastleMove(const ChessBoard& board) const{
    ChessPiece* king = board.GetPiece(startX, startY);
    if (king->GetMoveCount() != 0) return false;
    if (abs(startX-endX) != 2 || startY != endY) return false;
    int x = 7;
    int delta = 1;
    if (startX > endX){
        x = 0;
        delta = -1;
    }
    ChessPiece* rook = board.GetPiece(x, startY);
    if (rook && rook->GetMoveCount() != 0) return false;
    ChessColor opposingColor = SwitchColor(king->GetColor());
    for (int i = startX; GetCondition(i, startX, x); i += delta){
        if ((board.GetPiece(i, startY) && i != startX)
          || board.UnderAttack(opposingColor,i,startY)) return false;
    }
    return true;
}
Esempio n. 23
0
SelectDlg::SelectDlg( wxWindow *parent, wxWindowID id, const wxString &title,
	const wxPoint &position, const wxSize& size, long style ) :
	SelectDlgBase( parent, id, title, position, size, style )
{
	m_pLayer = NULL;
	m_iField = 0;
	m_iCondition = 0;
	m_strValue = _T("");

	AddValidator(this, ID_CONDITION, &m_iCondition);

	// The order of these must not change
	GetCondition()->Append(_T(" = "));
	GetCondition()->Append(_T(" > "));
	GetCondition()->Append(_T(" < "));
	GetCondition()->Append(_T(" >= "));
	GetCondition()->Append(_T(" <= "));
	GetCondition()->Append(_T(" <> "));
	GetCondition()->SetSelection(0);

	GetSizer()->SetSizeHints(this);
}
Esempio n. 24
0
Condition* DLGImporter::GetStateTrigger(unsigned int index) const
{
	if (index >= StateTriggersCount) {
		return NULL;
	}
	//8 = sizeof(VarOffset)
	str->Seek( StateTriggersOffset + ( index * 8 ), GEM_STREAM_START );
	ieDword Offset, Length;
	str->ReadDword( &Offset );
	str->ReadDword( &Length );
	//a zero length trigger counts as no trigger
	//a // comment counts as true(), so we simply ignore zero
	//length trigger text like it isn't there
	if (!Length) {
		return NULL;
	}
	str->Seek( Offset, GEM_STREAM_START );
	char* string = ( char* ) malloc( Length + 1 );
	str->Read( string, Length );
	string[Length] = 0;
	Condition *condition = GetCondition(string);
	free( string );
	return condition;
}
Esempio n. 25
0
float CCustomOutfit::GetHitTypeProtection(ALife::EHitType hit_type, s16 element)
{
	float fBase = m_HitTypeProtection[hit_type]*GetCondition();
	float bone = m_boneProtection->getBoneProtection(element);
	return fBase*bone;
}
Esempio n. 26
0
float CWeapon::GetConditionToShow	() const
{
	return	(GetCondition());//powf(GetCondition(),4.0f));
}
Esempio n. 27
0
string
Control::Print_str(int what_to_print)
{
string result;

ostringstream   s;
int   stmt1,stmt2;
GetEnclosedAssignments( &stmt1,&stmt2);
s<<"[ "<<stmt1<<", "<<stmt2<<" ]";
GetElsePartAssignments( &stmt1,&stmt2);
s<<"[ "<<stmt1<<", "<<stmt2<<" ]";

switch(GetControlKind( ))
   {
   case ADaAn_FOR      :result = "for("+GetLoopCounter( )+":"+GetForLowerBound( )->Print_str( )+":"+GetForUpperBound( )->Print_str( )+")"; break;
   case ADaAn_WHILE   :result = "while("+GetCondition( )->Print_str()+")"; break;
   case ADaAn_IF      :result = "if("+GetCondition( )->Print_str()+")"; break;
   case ADaAn_IF_ELSE   :result = "if the else("+GetCondition( )->Print_str()+")"; break;
   default: cerr<<endl<<"Fatal error, Control::Print_str(), unhandled operator ";
      throw(BAD_OPERATOR);
      exit(EXIT_FAILURE);
   }
result+="\tcounter = "+GetLoopCounter()+"\t"+s.str();
if(what_to_print == __SECURE_PRINT)
   return result;


result+="\n Affine constraints :";
for(vector<vector<Inequation*> >::iterator it=GetAffineDomain()->begin(); it != GetAffineDomain()->end(); ++it){
   result+="\n";
   for(vector<Inequation*>::iterator iti=(*it).begin(); iti != (*it).end(); ++iti)
      result+="\t"+(*iti)->Print_str();
   }

result+="\nNon Affine constraints :";
for(vector<vector<Inequation*> >::iterator it=GetNonAffineDomain()->begin(); it != GetNonAffineDomain()->end(); ++it){
   result+="\n";
   for(vector<Inequation*>::iterator iti=(*it).begin(); iti != (*it).end(); ++iti)
      result+="\t"+(*iti)->Print_str();
   }
result+="\n";
if(!IsIfElse())
   return result;


result+="\n Affine NOT DOMAIN :";
for(vector<vector<Inequation*> >::iterator it=GetAffineElseDomain()->begin(); it != GetAffineElseDomain()->end(); ++it){
   result+="\n";
   for(vector<Inequation*>::iterator iti=(*it).begin(); iti != (*it).end(); ++iti)
      result+="\t"+(*iti)->Print_str();
   }

result+="\nNon Affine  NOT_DOMAIN :";
for(vector<vector<Inequation*> >::iterator it=GetNonAffineElseDomain()->begin(); it != GetNonAffineElseDomain()->end(); ++it){
   result+="\n";
   for(vector<Inequation*>::iterator iti=(*it).begin(); iti != (*it).end(); ++iti)
      result+="\t"+(*iti)->Print_str();
   }
result+="\n";

return result;
}
Esempio n. 28
0
float CCustomOutfit::GetDefHitTypeProtection(ALife::EHitType hit_type)
{
	return m_HitTypeProtection[hit_type]*GetCondition();
}
Esempio n. 29
0
Condition*
Control::GetRegularDomain(int __id, vector<string>* __loop_counters, vector<string>* __param,LDemonstrator* __loop_ppts){
vector<string> variables=*__loop_counters;
if(IsLoop())
   variables.push_back(GetLoopCounter());
NormalizeConditions(__id,&variables,__param);
switch(GetNonAffineDomain()->size()){
   case 0:   goto simple_case;
      
   case 1:   {
      vector<Inequation*> v=*GetNonAffineDomain()->begin();
      if(v.size() <= 1)
         goto simple_case;
      }
   default:
      goto complicated_case;
   }

simple_case:
cout<<"\nSimple case";
exit(0);

if(IsIf() || IsIfElse() || IsWhileLoop())
   {
   if(IsWhileLoop()){
      cout<<"\nComplicated domain";
      exit(0);

      Inequation* ineq=new Inequation(new Expression(GetCounter()),FADA_GREATER_EQ,new Expression(0));
      Condition* count_ge_0 = new Condition (ineq);
      return new Condition(GetCondition(),FADA_AND,count_ge_0);
      }

   return GetCondition();
   }

if(IsForLoop()){
   Inequation* ineq1=new Inequation ( new Expression(GetLoopCounter( )),FADA_GREATER_EQ,GetForLowerBound( ));
   Inequation* ineq2=new Inequation ( new Expression(GetLoopCounter( )),FADA_LESS_EQ,GetForUpperBound( ));
   return new Condition( new Condition(ineq1), FADA_AND , new Condition(ineq2));
   }

cout<<"\nControl::GetRegularDomain ... inappropriate case 1";
exit(0);

complicated_case:
      cout<<"\nComplicated domain";
      exit(0);
Condition* result=new Condition(new Inequation(true));
for(vector<vector<Inequation*> >::iterator it=GetAffineDomain()->begin(); it != GetAffineDomain()->end(); ++it){
   result=new Condition(ToDNFTerm(&(*it)),FADA_AND,result);
   }
if(IsWhileLoop()){
   Inequation* ineq=new Inequation(new Expression(GetCounter()),FADA_GREATER_EQ,new Expression(1));
   Condition* count_ge_0 = new Condition (ineq);
   result=new Condition(count_ge_0,FADA_AND,result);
   }
ostringstream ch;
ch<<"domain_"<<__id;
Expression* non_affine=new Expression(ch.str());
for(vector<string>::iterator it=__loop_counters->begin(); it != __loop_counters->end();++it)
   non_affine->AddArgument(new Expression(*it));
if(IsLoop())
   non_affine->AddArgument(new Expression(GetLoopCounter()));
if(non_affine->IsVariable())
   __param->push_back(non_affine->GetVariableName());
return new Condition(new Condition(new Inequation(non_affine,FADA_NEQ,new Expression(0))),FADA_AND,result);
}
Esempio n. 30
0
void CCustomOutfit::net_Export(NET_Packet& P)
{
	inherited::net_Export	(P);
	P.w_float_q8			(GetCondition(),0.0f,1.0f);
}