コード例 #1
0
/*************************************************************************
	module		:[通話料金計算]
	function	:[
		1.
	]
	return		:[]
	common		:[]
	condition	:[]
	comment		:[]
	machine		:[V53]
	language	:[MS-C(Ver.6.0)]
	keyword		:[FCM]
	date		:[1994/08/12]
	author		:[奥村明]
*************************************************************************/
void	FCM_CostCalculate(UWORD		depart_code			/*	料金をセットする部門コード	*/
								, UBYTE	cost_pos			/*	料金テーブルの配列オフセット値	*/
								, UBYTE	stack_no)		/* スタック番号 *//* 追加  1997/09/19 s.takeuchi */
{
	UWORD	cost_time;											/**	同一料金時間	*/
	UWORD	rest_time;											/**	通信時間から料金計算した時間を差し引いた残り時間	*/
	UBYTE	cost_zone;											/**	料金帯(昼、夜、深夜)	*/
	TIME_DATA_t	start_time;												/**	通信開始時間(struct型BCD)	*/
	unsigned long	fcm_start_time;		/**	通信の開始時刻 *//* 1997/09/19 s.takeuchi */

	/* マルチ回線と共通にするため  1997/09/19 s.takeuchi */
	if (stack_no == 0) {	/** 1回線目(内蔵) */
		/* 標準仕様では従来通りFCM_Task用の大域変数を使う */
		/* マルチ回線仕様でも1回線目は従来の変数を使う */
		fcm_start_time = FaxComStartTime;	/** 通信開始時刻 */
		rest_time = FaxComPeriod;			/**	通信時間	*/
	}
#if (PRO_MULTI_LINE == ENABLE)
	else {		/** 二回線目以降(外付) */
		/* マルチ回線仕様では回線ごとにセットされている変数を使う */
		fcm_start_time = SYS_OptionModemTime[stack_no].StartTime;			/** 通信開始時刻 */
		rest_time = (UWORD)(SYS_OptionModemTime[stack_no].EndTime
							- SYS_OptionModemTime[stack_no].StartTime);		/**	通信時間	*/
	}
#endif

	/* マルチ回線と共通にするため  1997/09/19 s.takeuchi
	**CMN_LongTimeToBCD((TIME_DATA_t *)&start_time, FaxComStartTime);
	*/
	CMN_LongTimeToBCD((TIME_DATA_t *)&start_time, fcm_start_time);	/**	通信開始時間をstruct型BCDに変換	*/


	cost_zone = CheckCostZone(CMN_BCD_ToDecimal(start_time.Hour));		/**	通信開始時間が昼、夜、深夜のどの料金帯で始まったかを調べる	*/

	cost_time = CalculateFirstCostTime(&start_time);					/**	通信開始時の料金帯から次の料金帯までの時間(秒)を得る	*/

	for (;;) {
		if (cost_time < rest_time) {									/**	次の料金変更までの時間が残り通信時間より小さい時	*/
			SetCost(cost_time, cost_zone, cost_pos, depart_code);		/**	料金を管理ファイルにセットする	*/
			rest_time -= cost_time;										/**	残り(料金計算していない)通信時間	*/
			if (cost_zone++ == MID_NIGHT) {
				cost_zone = NOON;
			}
		}
		else {
			SetCost(rest_time, cost_zone, cost_pos, depart_code);		/**	料金を管理ファイルにセットする	*/
			return;
		}
		cost_time = CalculateCostTime(cost_zone);						/**	同一料金帯の時間(秒)を得る	*/
	}
}
コード例 #2
0
//---------------------------------------------------------------------------
ChooseActionOption::ChooseActionOption(
  const double contribution,
  const double cost,
  const std::string& description,
  const std::string& message)
{
  SetContribution(contribution);
  SetCost(cost);
  SetDescription(description);
  SetMessageChoice(message);
}
コード例 #3
0
ribi::gtst::VotingOption::VotingOption(
    const double chance,
    const double cost,
    const std::string& description)
    : m_chance{},
      m_cost{},
      m_description{}
{
    SetChance(chance);
    SetCost(cost);
    SetDescription(description);
}
コード例 #4
0
ファイル: b2World.cpp プロジェクト: skitzoid/Box2D-MT
	b2SolveTask(int32 bodyCount, int32 contactCount, int32 jointCount,
		b2Body** bodies, b2Contact** contacts, b2Joint** joints,
		b2Velocity* velocities, b2Position* positions, b2ContactListener* listener,
		const b2TimeStep& timestep, b2Vec2 gravity, bool allowSleep,
		b2SolveTask* next)
		: m_island(bodyCount, contactCount, jointCount,
		bodies, contacts, joints,
		velocities, positions, listener)
	{
		m_timestep = &timestep;
		m_gravity = gravity;
		m_allowSleep = allowSleep;
		m_next = next;
		SetCost(b2GetIslandCost(bodyCount, contactCount, jointCount));
	}
コード例 #5
0
ファイル: b2World.cpp プロジェクト: bog2k3/Box2D-MT
    void AddIsland(int32 bodyCount, int32 contactCount, int32 jointCount,
        b2Body** bodies, b2Contact** contacts, b2Joint** joints,
        b2Velocity* velocities, b2Position* positions)
    {
        m_islands[m_islandCount++] = b2Island(
            bodyCount, contactCount, jointCount,
            bodies, contacts, joints,
            velocities, positions, m_contactListener);

        m_bodyCount += bodyCount;
        m_contactCount += contactCount;
        m_jointCount += jointCount;

        SetCost(b2GetIslandCost(m_bodyCount, m_contactCount, m_jointCount));
    }
コード例 #6
0
ribi::gtst::ChooseActionOption::ChooseActionOption(
  const double contribution,
  const double cost,
  const std::string& description,
  const std::string& message)
  : m_contribution{},
    m_cost{},
    m_description{},
    m_message_choice{}
{
  SetContribution(contribution);
  SetCost(cost);
  SetDescription(description);
  SetMessageChoice(message);
}
コード例 #7
0
void ModifiedFlood (location_t here)
{
  direction_t direction;
  cost_t smallestCost;
  ListReset();
  ListAdd (here);
  while (!ListIsEmpty()) {
    here = ListStackPop();
    if (Cost (here) == 0) {
      continue;
    }
    direction = SmallestNeighbourDirection (here);
    smallestCost = Cost (Neighbour (here, direction));
    SetDirection (here, direction);
    if (Cost (here) != smallestCost + 1) {
      SetCost (here, smallestCost + 1);
      AddOpenNeighboursToList (here);
    }
  }
}
コード例 #8
0
void FloodMazeClassic (location_t target)
{
  location_t here;
  location_t nextLoc;
  cost_t costHere;
  cost_t costNext;
  for (here.row = 0; here.row < MAZE_ROWS; here.row++) {
    for (here.col = 0; here.col < MAZE_COLS; here.col++) {
      SetCost (here, MAX_COST);
      SetDirection (here, INVALID);
    }
  }
  SetCost (target, 0);
  ListReset();
  ListAdd (target);
  while (!ListIsEmpty()) {
    /*
     * TODO: show costs and directions for all combinations
     * of testing against MAX_COST vs smaller than and stack vs queue
     */
    here = ListQueueHead();
    //here = ListStackPop();
    costNext = Cost (here) + 1;
    if (HasExit (here, NORTH)) {
      nextLoc = Neighbour (here, NORTH);
      if (Cost (nextLoc) > costNext) {
        SetDirection (nextLoc, SOUTH);
        SetCost (nextLoc, costNext);
        ListAdd (nextLoc);
      }
    }

    if (HasExit (here, EAST)) {
      nextLoc = Neighbour (here, EAST);
      if (Cost (nextLoc) > costNext) {
        SetDirection (nextLoc, WEST);
        SetCost (nextLoc, costNext);
        ListAdd (nextLoc);
      }
    }

    if (HasExit (here, SOUTH)) {
      nextLoc = Neighbour (here, SOUTH);
      if (Cost (nextLoc) > costNext) {
        SetDirection (nextLoc, NORTH);
        SetCost (nextLoc, costNext);
        ListAdd (nextLoc);
      }
    }

    if (HasExit (here, WEST)) {
      nextLoc = Neighbour (here, WEST);
      if (Cost (nextLoc) > costNext) {
        SetDirection (nextLoc, EAST);
        SetCost (nextLoc, costNext);
        ListAdd (nextLoc);
      }
    }

  }
  //printf ("Max List Length = %d List additions = %d path cost = %d\n", ListMaxSize(), ListAdditions(), Cost (Home()));
}
コード例 #9
0
ファイル: Problem.cpp プロジェクト: ssashir06/DieHardBucets
 void Problem::BuildGraph()
 {
     CreateNodes();
     Link();
     SetCost();
 }