bool ForwardRateSourceStochastic::isOK()
 {
     if (!ForwardRateSource::isOK())
     {
         return false;
     }
     if (forwardSimulationDates.size() > 0)
     {
         if (!isInRange(forwardSimulationDates.front()))
         {
             errorTracking->populateErrorMessage("First forward date is outside the rate source range");
             return false;
         }
         if (!isInRange(forwardSimulationDates.back()))
         {
             errorTracking->populateErrorMessage("Last forward date is outside the rate source range");
             return false;
         }
     }
     if (vrs == NULL)
     {
         errorTracking->populateErrorMessage("Volatility Rate Source has not been set");
         return false;
     }
     if (!vrs->extendsTo(finalDate))
     {
         errorTracking->populateErrorMessage("Volatility Rate Source does not extend to the end of the Forward Rate Source");
     }
     if (vrs->getAnchorDate() != anchorDate)
     {
         errorTracking->populateErrorMessage("Volatility Rate Source does not have the same anchor date as the Forward Rate Source");
     }
     return !errorTracking->getHasErrors();
 }
示例#2
0
void printAlignedText(double dbHorizontalAlign,double dbVerticalAlign,u8 chMinRow,u8 chMinColumn,u8 chMaxRow,u8 chMaxColumn,bool blnMultiLine,bool blnHideOverflowText,struct stConsoleCursorLocation *stTexteLocation,const char *strTexteFormat,...) {
static char strTextBuffer[1024];
va_list pArguments;
unsigned int intBreakLinesCount;
char **strBreakLines;
double dbTextContainerX[2]={0,0},dbTextContainerY[2]={0,0};
    va_start(pArguments,strTexteFormat);
    vsnprintf(strTextBuffer,sizeof(strTextBuffer),strTexteFormat,pArguments);
    va_end(pArguments);
    if (chMinColumn>chMaxColumn) {
        permutePointers((void *) &chMinColumn,(void *) &chMaxColumn);
    }
    if (chMinRow>chMaxRow) {
        permutePointers((void *) &chMinRow,(void *) &chMaxRow);
    }
    dbTextContainerX[1]=strlen(strTextBuffer)-1;
    if (blnMultiLine) {
        intBreakLinesCount=chMaxRow-chMinRow+1;
        if ((strBreakLines=getBreakStrings(strTextBuffer,' ',chMaxColumn-chMinColumn+1,&intBreakLinesCount))!=NULL) {
            dbTextContainerY[1]=intBreakLinesCount-1;
            dbHorizontalAlign=getRoundNumber(getPolyContainerPosition(&dbTextContainerX[0],2,chMinColumn,chMaxColumn,dbHorizontalAlign));
            dbVerticalAlign=getRoundNumber(getPolyContainerPosition(&dbTextContainerY[0],2,chMinRow,chMaxRow,dbVerticalAlign));
            if (blnHideOverflowText) {
                while ((intBreakLinesCount) && (isInRange(dbVerticalAlign,chMinRow,chMaxRow,true,true))) {
                    printTextInColumnsRange(dbVerticalAlign,dbHorizontalAlign,chMinColumn,chMaxColumn,stTexteLocation,"%s",strTextBuffer);
                    dbVerticalAlign++;
                    intBreakLinesCount--;
                }
            }
            else {
                while (intBreakLinesCount) {
                    printLocatedText(dbVerticalAlign,dbHorizontalAlign,stTexteLocation,"%s",strTextBuffer);
                    resetSavedPreviousCursorPosition();
                    dbVerticalAlign++;
                    intBreakLinesCount--;
                }
            }
            free(strBreakLines);
            strBreakLines=NULL;
        }
    }
    else {
        dbHorizontalAlign=getRoundNumber(getPolyContainerPosition(&dbTextContainerX[0],2,chMinColumn,chMaxColumn,dbHorizontalAlign));
        dbVerticalAlign=getRoundNumber(getPolyContainerPosition(&dbTextContainerY[0],2,chMinRow,chMaxRow,dbVerticalAlign));
        if (blnHideOverflowText) {
            if (isInRange(dbVerticalAlign,chMinRow,chMaxRow,true,true)) {
                printTextInColumnsRange(dbVerticalAlign,dbHorizontalAlign,chMinColumn,chMaxColumn,stTexteLocation,"%s",strTextBuffer);
            }
        }
        else {
            printLocatedText(dbVerticalAlign,dbHorizontalAlign,stTexteLocation,"%s",strTextBuffer);
            resetSavedPreviousCursorPosition();
        }
    }
}
示例#3
0
/*
 * Retrieves a list of all jump moves currently possible for a player.
 *
 * @params: (player) - the player whose moves are to be put in the list
 * @return: a LinkedList struct of jump moves currently possible for the player, or NULL if any allocation errors occurred
 */
static struct LinkedList* getPossibleJumps (char** board, int player){
	struct LinkedList* jumpMoves = LinkedList_new(&PossibleMove_free);
	if(jumpMoves == NULL){ //allocation failed
		return NULL;
	}
	
	for (int x = 1; x <= Board_SIZE; x++){
		for (int y = 1; y <= Board_SIZE; y++){			
			if (Board_evalPiece(board, x, y, player) <= 0){
				continue;
			}
			for (int i = -1; i <= 1; i += 2){
				for (int j = -1; j <= 1; j += 2){
					struct Tile* destTile = NULL;
					if (!isInRange(x+i,y+j) || !isInRange(x+2*i,y+2*j)){
						continue;
					}
					int pieceIsKing = Board_evalPiece(board, x, y, player) == 3;
					if (pieceIsKing){
						destTile = canKingCaptureInDirection(board, x, y, i, j);
					}
					else{
						int enemyNearby = Board_evalPiece(board, x+i, y+j, player) < 0;
						int enemyIsCapturable = Board_isEmpty(board, x+2*i, y+2*j);
						if(enemyNearby && enemyIsCapturable){
							destTile = Tile_new(x+2*i, y+2*j);
							if (destTile == NULL){ // allocation failed
								return NULL;
							}
						}
					}
					if (!destTile){
						continue;
					}
					struct LinkedList* jumpSteps = LinkedList_new(&Tile_free);
					if (jumpSteps == NULL){ // allocation failed
						Tile_free(destTile);
						return NULL;
					}
					LinkedList_add(jumpSteps, destTile);
					struct PossibleMove* possibleJumpMove = PossibleMove_new(x, y, jumpSteps, board);
					if (possibleJumpMove == NULL){ // allocation failed
						Tile_free(destTile);
						LinkedList_free(jumpSteps);
						return NULL;
					}
					populateJumpList(jumpMoves, possibleJumpMove);
				}
			}
		}	
	}
	return jumpMoves;
}
PixelClass PixelClassifier::getClass(uchar hue, uchar saturation, uchar value) {
    // return the class of a color


    if(isInRange(hue, 20) && saturation > 100 && value > 150) // orange
        return BALLE;
    if(isInRange(hue, 40) && saturation > 100  && value > 100) // jaune
        return BUT;
    if(isInRange(hue, 60) && saturation > 100 && value > 100) // vert
        return TERRAIN;
    if(value > 150) // Blanc
        return LIGNE;
    return POUBELLE;
}
示例#5
0
char MaIterator::operator *() {
    SAFE_POINT(isInRange(position), "Out of boundaries", U2Msa::INVALID_CHAR);
    const QPoint maPoint = getMaPoint();
    SAFE_POINT(0 <= maPoint.x() && maPoint.x() < ma->getLength() &&
               0 <= maPoint.y() && maPoint.y() < ma->getNumRows(), "Out of boundaries", U2Msa::INVALID_CHAR);
    return ma->charAt(maPoint.y(), maPoint.x());
}
void invoking(void)
{
	waitButton(&xPos, &yPos);
	if(isInRange(xPos, yPos, APP1_X, APP1_Y)){
		side_to_side();
	}
	else if(isInRange(xPos, yPos, APP2_X, APP2_Y)){
		starts_swinging();
	}
	else if(isInRange(xPos, yPos, APP3_X, APP3_Y)){
		inverted_pendulum();
	}
		else if(isInRange(xPos, yPos, APP4_X, APP4_Y)){
		circular_motion();
	}
}
示例#7
0
  bool TimeRange::isInRange( const DateTime& startTime,
                             const DateTime& endTime,
                             int startDay,
                             int endDay,
                             const DateTime& time,
                             int day )
  {
    UtcTimeOnly timeOnly (time);

    if( startDay == endDay )
    {
      if( day != startDay )
        return true;
      return isInRange( startTime, endTime, time );
    }
    else if( startDay < endDay )
    {
      if( day < startDay || day > endDay )
        return false;
      else if( day == startDay && timeOnly < startTime )
        return false;
      else if( day == endDay && timeOnly > endTime )
        return false;
    }
    else if( startDay > endDay )
    {
      if( day < startDay && day > endDay )
        return false;
      else if( day == startDay && timeOnly < startTime )
        return false;
      else if( day == endDay && timeOnly > endTime )
        return false;
    }
    return true;
  }
//Fires the weapon at the target
void BaseWeapon::shootAt(AICharacter * target) {
	
	if (canShoot() == true && isInRange(target->Position) == true && _fireCooldownTime <= 0) {

		//reduce the clip size and reset the time until we can fire next
		_shotsInClip--;
		_fireCooldownTime = FireRate;

		_weaponFired = true;

		float calAccuracy = getAccuracyToCharIncCover(target);

		if (rand() % 100 < calAccuracy) {

			//hit target, damage them for the amount of bullets we fire
			for (int i = 0; i < BulletsPerShot; i++) 
				target->damageTaken(Holder);

			_targetPos = target->Position;
			_shotType = kHit;
		}
		//if they AI missed, create a random position near the target for the simulation line to go to
		else {

			_shotType = kMiss;
			_targetPos = target->Position + Vector3((rand() % 30) + - 30, (rand() % 30) + - 30, 0);
		}
	}
}
示例#9
0
/*
 * Checks whether a piece currently has any possible jump moves.
 *
 * @params: (x,y) - the coordinates of the piece to be checked
 *			(player) - the player the check is done for
 * @return: 1 (true) if the piece has a possible jump move, 0 (false) otherwise
 */
static int isJumpPossible(char** board, int x, int y, int player){
	if (Board_evalPiece(board, x, y, player) <= 0){
		return 0;
	}
	for (int i = -1; i <= 1; i += 2){
		for (int j = -1; j <= 1; j += 2){
			if (!isInRange(x+2*i,y+2*j)){
				continue;
			}
			int pieceIsKing = Board_evalPiece(board, x, y, player) == 3;
			if (pieceIsKing){
				struct Tile* dest = canKingCaptureInDirection(board, x, y, i, j);
				if (dest){
					Tile_free(dest);
					return 1;
				}
			}
			int enemyNearby = Board_evalPiece(board, x+i, y+j, !player) > 0;
			int enemyIsCapturable = Board_isEmpty(board, x+2*i, y+2*j);
			if(enemyNearby && enemyIsCapturable){
				return 1;
			}
		}
	}
	return 0;
}
//Supresses a target, reducing the weapons shots in clip and modifying the targets accuracy/move modifiers
void BaseWeapon::suppressTarget(AICharacter * target) {

	//check if the weapon is capable of suppression, and is in range of target
	if (canSuppress() == true && isInRange(target->Position)) {

		//a suppression's effect on a unit is continous, but only reduce its cooldowns..
		//..and only draw within the cool down boundaries. This prevents a constant line effect and rapid ammo draining
		if (_fireCooldownTime <= 0) {

			_shotsInClip--;
			_fireCooldownTime = FireRate;

			_weaponFired = true;
			_shotType = kSuppress;
			_targetPos = target->Position;
		}

		//don't modify the targets modifiers if they are slower than what we'd make them by suppressing
		if (target->AccuracyModifier > SuppressPenality)
			target->AccuracyModifier = SuppressPenality;

		if (target->MoveModifier > SuppressPenality)
			target->MoveModifier = SuppressPenality;
	}
}
示例#11
0
void FlowContextController::newRoutePoint(QPoint location)
{
    if (getCurrentColor() == -1) return;
    if (!isInRange(location)) return;

    // don't link to terminal dots of other colors
    if (isTerminalDotsOfOthers(location)) return;

    truncateCurrentRoute(location);

    if (m_current_route.size() == 0)
        // first time or over-truncated?
        m_current_route.append(location);
    else if (!isOutOfTerminal(location)) {
        // or satisfy the conditions to complete route
        for (int i = 1; i <= MAX_FIND_ROUTE; i++)
            if (makeReachableBy(m_current_route.back(), location, i)) {
                m_current_route.append(location);
                break;
            }
    }

    m_stable->cloneTo(*m_beta, false); // update later
    m_beta->addRoute(getCurrentColor(), m_current_route);
    // i.e. addRoute here will update view
}
示例#12
0
void FlowContextController::startRoute(QPoint location)
{
    if (!isInRange(location)) return;

    int dot_color = m_board->getColorAt(location);
    int context_color = m_stable->getColorAt(location);
    int color = dot_color != -1 ?
                dot_color : context_color;

    setCurrentColor(color);

    if (getCurrentColor() == -1)
        // on the board
        return;

    // update moves count
    if (getCurrentColor() != m_previous_legal_color) {
        setMoves(getMoves() + 1);
        // save for undo
        m_undo.push(new FlowContext(m_board, this));
        m_stable->cloneTo(*m_undo.top());
    }
    m_previous_legal_color = getCurrentColor();

    if (dot_color != -1)
        // is a terminal
        m_current_route.clear();
    else
        // is on a existing route
        m_current_route = m_stable->getRouteOf(color);
    m_stable->clearRouteOf(color);

    newRoutePoint(location);
}
示例#13
0
文件: chunk.cpp 项目: karda/isis
void Chunk::copyRange( const size_t source_start[], const size_t source_end[], Chunk &dst, const size_t destination[] ) const
{
	LOG_IF( ! isInRange( source_start ), Debug, error )
			<< "Copy start " << util::vector4<size_t>( source_start )
			<< " is out of range (" << getSizeAsString() << ") at the source chunk";
	LOG_IF( ! isInRange( source_end ), Debug, error )
			<< "Copy end " << util::vector4<size_t>( source_end )
			<< " is out of range (" << getSizeAsString() << ") at the source chunk";
	LOG_IF( ! dst.isInRange( destination ), Debug, error )
			<< "Index " << util::vector4<size_t>( destination )
			<< " is out of range (" << getSizeAsString() << ") at the destination chunk";
	const size_t sstart = getLinearIndex( source_start );
	const size_t send = getLinearIndex( source_end );
	const size_t dstart = dst.getLinearIndex( destination );
	getValueArrayBase().copyRange( sstart, send, *dst, dstart );
}
 boost::shared_ptr<ForwardRateSource> ForwardCurveCMADeterministic::rollForward(Date toDate)
 {
     vector<Date> originalDates = curve->getObservationDates();
     vector<Date> rolledObservationDates;
     vector<double> rolledFwds;
     if (!isInRange(toDate))
     {
         rolledObservationDates.push_back(toDate);
         rolledFwds.push_back(1.0);
     }
     else 
     {
         for (size_t i = 0; i < originalDates.size(); ++i) 
         {
             if (originalDates[i] >= toDate)
             {
                 rolledObservationDates.push_back(originalDates[i]);
                 rolledFwds.push_back(getForward(originalDates[i]));
             }
         }
     }
     return boost::shared_ptr<ForwardCurveCMADeterministic>(
                                 new ForwardCurveCMADeterministic(toDate, 
                                                                rolledObservationDates, 
                                                                rolledFwds,
                                                                LINEAR,
                                                                true));        
 } 
示例#15
0
bool FrozenPathingConditionCall::operator()(const Position& startPos, const Position& testPos,
        const FindPathParams& fpp, int32_t& bestMatchDist) const
{
	if (!isInRange(startPos, testPos, fpp)) {
		return false;
	}

	if (fpp.clearSight && !g_game.isSightClear(testPos, targetPos, true)) {
		return false;
	}

	int32_t testDist = std::max<int32_t>(Position::getDistanceX(targetPos, testPos), Position::getDistanceY(targetPos, testPos));
	if (fpp.maxTargetDist == 1) {
		if (testDist < fpp.minTargetDist || testDist > fpp.maxTargetDist) {
			return false;
		}

		return true;
	} else if (testDist <= fpp.maxTargetDist) {
		if (testDist < fpp.minTargetDist) {
			return false;
		}

		if (testDist == fpp.maxTargetDist) {
			bestMatchDist = 0;
			return true;
		} else if (testDist > bestMatchDist) {
			//not quite what we want, but the best so far
			bestMatchDist = testDist;
			return true;
		}
	}
	return false;
}
示例#16
0
void InteractionPoint::drawInteractionSymbol( int mouseX, int mouseY, int characterXpos, int characterYpos )
{
	assert( interactionTexture != NULL );
	if ( markedAsDeletable ) {
		return;
	}

	if ( ! isMouseOver( mouseX, mouseY ) ) {
		return;
	}

    uint8_t available_symbol = 0;


    if ( isInRange(characterXpos,characterYpos) )
	{
	    available_symbol = 1;
	}

	DrawingHelpers::mapTextureToRect( interactionTexture->getTexture(available_symbol),
	                                  mouseX+world_x,
	                                  interactionTexture->getTexture(available_symbol).width,
	                                  mouseY+world_y,
	                                  interactionTexture->getTexture(available_symbol).height );
}
Range getMinRange(int a[3][3], int n) {
		Range *ranges = (Range*)malloc(sizeof(Range)*n);
		int i, j, k, index, minRangeIndex;

		for (j=0 ; j<n ; j++)
				ranges[j].start = ranges[j].end = a[0][j];
		// we will keep all these ranges sorted in start.

		for (i=1 ; i<n ; i++) {
				for (j=0 ; j<n ;j++) {
						index = binarySearch(ranges, n, a[i][j]);
						if (isInRange(ranges[index], a[i][j]))
								continue;
						else if ((index+1 < n) && (a[i][j] - ranges[index].end > ranges[index+1].start - a[i][j]))
								ranges[index+1].start = a[i][j];
						else
								ranges[index].end = a[i][j];
				}
		}

		minRangeIndex = 0;
		for (i=1 ; i<n ; i++)
				if(ranges[i].end - ranges[i].start < ranges[minRangeIndex].end - ranges[minRangeIndex].start)
						minRangeIndex = i;
		return ranges[minRangeIndex];
}
示例#18
0
bool FlowContextController::makeReachableBy(QPoint f, QPoint t, int depth)
{
    if (depth <= 0) return false;

    static const int MOVE_TYPE = 4;
    static const QPoint MOVE[4] = {
        QPoint(1, 0), QPoint(-1, 0),
        QPoint(0, 1), QPoint(0, -1),
    };

    for (int i = 0; i < MOVE_TYPE; i++)
        if (f + MOVE[i] == t) return true;

    for (int i = 0; i < MOVE_TYPE; i++) {
        QPoint new_loc = f + MOVE[i];

        if (!isInRange(new_loc)
                || m_board->getColorAt(new_loc) != -1
                || m_current_route.count(new_loc) > 0)
            continue;

        m_current_route.push_back(new_loc);

        if (makeReachableBy(new_loc, t, depth - 1))
            return true;
        else
            m_current_route.pop_back();
    }

    return false;
}
示例#19
0
bool FrozenPathingConditionCall::operator()(const Position& startPos, const Position& testPos,
	const FindPathParams& fpp, int32_t& bestMatchDist) const
{
	if(!isInRange(startPos, testPos, fpp))
		return false;

	if(fpp.clearSight && !g_game.isSightClear(testPos, targetPos, true))
		return false;

	int32_t testDist = std::max(std::abs(targetPos.x - testPos.x), std::abs(targetPos.y - testPos.y));
	if(fpp.maxTargetDist == 1)
		return (testDist >= fpp.minTargetDist && testDist <= fpp.maxTargetDist);

	if(testDist <= fpp.maxTargetDist)
	{
		if(testDist < fpp.minTargetDist)
			return false;

		if(testDist == fpp.maxTargetDist)
		{
			bestMatchDist = 0;
			return true;
		}
		else if(testDist > bestMatchDist)
		{
			//not quite what we want, but the best so far
			bestMatchDist = testDist;
			return true;
		}
	}

	return false;
}
示例#20
0
  bool TimeRange::isInSameRange( const DateTime& startTime,
                                 const DateTime& endTime,
                                 int startDay,
                                 int endDay,
                                 const DateTime& time1,
                                 const DateTime& time2 )
  {
    if( !isInRange( startTime, endTime, startDay, endDay, time1, time1.getWeekDay() ) )
      return false;

    if( !isInRange( startTime, endTime, startDay, endDay, time2, time2.getWeekDay() ) )
      return false;

    int absoluteDay1 = time1.getJulianDate() - time1.getWeekDay();
    int absoluteDay2 = time2.getJulianDate() - time2.getWeekDay();
    return absoluteDay1 == absoluteDay2;
  }
示例#21
0
  bool TimeRange::isInRange( const DateTime& startTime,
                             const DateTime& endTime,
                             int startDay,
                             int endDay,
							 const DateTime& time ) 
  {
    return isInRange( startTime, endTime, startDay, endDay, time, time.getWeekDay() );
  }
示例#22
0
 std::list< std::list<Enemy*>::iterator > findEnemiesInRange(Vec2d position, double minRange, double maxRange){
     std::list< std::list<Enemy*>::iterator > ret;
     for(auto it = enemies.begin();  it!=enemies.end(); it++){
         if(isInRange(position, minRange, maxRange, *it))
             ret.push_back(it);
     }
     return ret;
 }
int binarySearch(Range *ranges, int n, int key) {
		int low = 0, mid, high = n-1;
		while(low + 1 < high) {
				mid = (low+high)/2;
				if(isInRange(ranges[mid], key))
						return mid;
				if(isInRange(ranges[low], key))
						return low;			   
				if(isInRange(ranges[high], key) || ranges[high].start <= key)
						return high;
				if (key < ranges[mid].start)
						high = mid;
				else if (ranges[mid].end < key)
						low = mid;
		}
		return low;
}
示例#24
0
bool ImageSegmentComputer::Segment::isInRange(
        size_t rangeStartRow,
        size_t rangeNumRows,
        size_t& firstGlobalRowInThisSegment,
        size_t& numRowsInThisSegment) const
{
    return isInRange(firstRow, endRow(), rangeStartRow, rangeNumRows,
                     firstGlobalRowInThisSegment, numRowsInThisSegment);
}
示例#25
0
    double VolatilitySurfaceMoneyness::getVolatility(Date toDate) const                               
    {
        if (!isInRange(toDate)) 
        {
            return numeric_limits<double>::quiet_NaN();
        }
        double yf = dayCounter->yearFraction(anchorDate, toDate);
        return (*interpolator)(yf, 0.0, allowExtrapolation);

   }
示例#26
0
 double VolatilitySurfaceMoneyness::getVolatility(Date toDate, double strike, double forward) const 
 {
     if (!isInRange(toDate, strike, forward)) 
     {
         return numeric_limits<double>::quiet_NaN();
     }
     double yf = dayCounter->yearFraction(anchorDate, toDate);
     double moneyness = (strike - forward) / forward;
     return (*interpolator)(yf, moneyness, allowExtrapolation);
 }
示例#27
0
double getPolyContainerPosition(const double *dbPolyPointsPositions,unsigned int intPointsCount,double dbContainerMinPosition,double dbContainerMaxPosition,double dbPositionType) {
double varout=dbContainerMinPosition+dbPolyPointsPositions[getArrayMinValueIndex((const void *) dbPolyPointsPositions,intPointsCount,sizeof(double))];
    if (fabs(dbPositionType)<1) {
        varout=dbContainerMinPosition+dbPositionType*(dbContainerMaxPosition-dbContainerMinPosition);
    }
    else if (isInRange(dbPositionType,ALIGN_NONE,-1,true,true)) {
        varout=getAlignedPolyContainerPosition(dbPolyPointsPositions,intPointsCount,dbContainerMinPosition,dbContainerMaxPosition,(enum ALIGNEMENTS) (int) getRoundNumber(dbPositionType));
    }
    return varout;
}
示例#28
0
文件: chunk.cpp 项目: karda/isis
size_t Chunk::compareRange( const size_t source_start[], const size_t source_end[], const Chunk &dst, const size_t destination[] ) const
{
	LOG_IF( ! isInRange( source_start ), Debug, error )
			<< "memcmp start " << util::vector4<size_t>( source_start )
			<< " is out of range (" << getSizeAsString() << ") at the first chunk";
	LOG_IF( ! isInRange( source_end ), Debug, error )
			<< "memcmp end " << util::vector4<size_t>( source_end )
			<< " is out of range (" << getSizeAsString() << ") at the first chunk";
	LOG_IF( ! dst.isInRange( destination ), Debug, error )
			<< "Index " << util::vector4<size_t>( destination )
			<< " is out of range (" << getSizeAsString() << ") at the second chunk";
	LOG( Debug, verbose_info )
			<< "Comparing range from " << util::vector4<size_t>( source_start ) << " to " << util::vector4<size_t>( source_end )
			<< " and " << util::vector4<size_t>( destination );
	const size_t sstart = getLinearIndex( source_start );
	const size_t send = getLinearIndex( source_end );
	const size_t dstart = dst.getLinearIndex( destination );
	return getValueArrayBase().compare( sstart, send, dst.getValueArrayBase(), dstart );
}
示例#29
0
void Scene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
{
    if(event->mimeData()->hasFormat("Picture") && isInRange(event->scenePos())
            && !(itemAt(event->scenePos(), QTransform()))) {
        event->setDropAction(Qt::MoveAction);
        event->accept();
    }
    else
        event->ignore();
}
示例#30
0
void InteractionPoint::startInteraction( int characterXpos, int characterYpos )
{
	if ( markedAsDeletable ) {
		return;
	}

    if ( isInRange( characterXpos, characterYpos ) )
    {
        LuaFunctions::executeLuaScript( interactionCode );
    }
}