コード例 #1
0
ファイル: Scselec2.cpp プロジェクト: jimmccurdy/ArchiveGit
int scSelection::NextLine(  )
{
	scSelection sortedSelect( *this );
	
	sortedSelect.Sort();
	TextMarker&	mark	= sortedSelect.fMark;
	TextMarker&	point	= sortedSelect.fPoint;

	scTextline*	nextTxl;	

	if ( point.fTxl ) {
		nextTxl = point.fTxl;	
		do {
			nextTxl = nextTxl->GetNextLogical();	
		} while ( nextTxl && SameBaseline( point.fTxl, nextTxl ) );

		if ( !nextTxl )
			return 0;

		nextTxl = SearchRight( nextTxl, point.fSelMaxX );

		if ( !nextTxl )
			return 0;
		
		point.fTxl = nextTxl;
			
		SelectLocateOnLine( &point, eCursForward );
		mark = point;		
	}
	else if ( mark.fTxl ) {
		nextTxl = mark.fTxl;	
		do {
			nextTxl = nextTxl->GetNextLogical();	
		} while ( nextTxl && SameBaseline( mark.fTxl, nextTxl ) );

		if ( !nextTxl )
			return 0;

		nextTxl = SearchRight( nextTxl, mark.fSelMaxX );

		if ( !nextTxl )
			return 0;
		
		point.fTxl = nextTxl;
			
		SelectLocateOnLine( &mark, eCursForward );
		point = mark;		
	}

	SetMark( mark );
	SetPoint( point );
	return mark.fTxl != 0;
}
コード例 #2
0
ファイル: JPSPlus.cpp プロジェクト: maxrenke/gppc-2014
inline void JPSPlus::ExploreFromParentUp(PathfindingNode * currentNode, DistantJumpPoints * distantJumpPoints)
{
	if (distantJumpPoints->jumpDistance[Right] != 0) SearchRight(currentNode, distantJumpPoints->jumpDistance[Right]);
	if (distantJumpPoints->jumpDistance[UpRight] != 0) SearchUpRight(currentNode, distantJumpPoints->jumpDistance[UpRight]);
	if (distantJumpPoints->jumpDistance[Up] != 0) SearchUp(currentNode, distantJumpPoints->jumpDistance[Up]);
	if (distantJumpPoints->jumpDistance[UpLeft] != 0) SearchUpLeft(currentNode, distantJumpPoints->jumpDistance[UpLeft]);
	if (distantJumpPoints->jumpDistance[Left] != 0) SearchLeft(currentNode, distantJumpPoints->jumpDistance[Left]);
}
コード例 #3
0
ファイル: JPSPlus.cpp プロジェクト: maxrenke/gppc-2014
inline void JPSPlus::ExploreFromParentDown(PathfindingNode * currentNode, DistantJumpPoints * distantJumpPoints)
{
	if (distantJumpPoints->jumpDistance[Left] != 0) SearchLeft(currentNode, distantJumpPoints->jumpDistance[Left]);
	if (distantJumpPoints->jumpDistance[DownLeft] != 0) SearchDownLeft(currentNode, distantJumpPoints->jumpDistance[DownLeft]);
	if (distantJumpPoints->jumpDistance[Down] != 0) SearchDown(currentNode, distantJumpPoints->jumpDistance[Down]);
	if (distantJumpPoints->jumpDistance[DownRight] != 0) SearchDownRight(currentNode, distantJumpPoints->jumpDistance[DownRight]);
	if (distantJumpPoints->jumpDistance[Right] != 0) SearchRight(currentNode, distantJumpPoints->jumpDistance[Right]);
}
コード例 #4
0
ファイル: JPSPlus.cpp プロジェクト: maxrenke/gppc-2014
inline void JPSPlus::ExploreFromParentAllDirections(PathfindingNode * currentNode, DistantJumpPoints * distantJumpPoints)
{
	SearchDown(currentNode, distantJumpPoints->jumpDistance[Down]);
	SearchDownRight(currentNode, distantJumpPoints->jumpDistance[DownRight]);
	SearchRight(currentNode, distantJumpPoints->jumpDistance[Right]);
	SearchUpRight(currentNode, distantJumpPoints->jumpDistance[UpRight]);
	SearchUp(currentNode, distantJumpPoints->jumpDistance[Up]);
	SearchUpLeft(currentNode, distantJumpPoints->jumpDistance[UpLeft]);
	SearchLeft(currentNode, distantJumpPoints->jumpDistance[Left]);
	SearchDownLeft(currentNode, distantJumpPoints->jumpDistance[DownLeft]);
}
コード例 #5
0
	vector<int> searchRange(vector<int>& nums, int target) 
	{
		vector<int> res(2,-1);
		if(nums.empty())
			return res;
		int left=SearchLeft(nums,target),right=SearchRight(nums,target);
		if(left<=right)
		{
			res[0]=left;
			res[1]=right;
		}
		return res;
	}
コード例 #6
0
ファイル: BiTree.c プロジェクト: huangyingw/binaryTree
int main()
{
	int i;
	BiTreeNode *q[MaxSize+1];
	BiTreeNode *root;
	int left,right,temp;
	int Num[MaxSize]={0};
	char strA[MaxSize]="befcgdh";//pre_order
	char strB[MaxSize]="febgchd";//in_order
	char point;int n;
	n=strlen(strA);
	Initiate(&root);
	for(i=0;i<n;i++)
	{
		point=strA[i];
		temp=Search(strB,point);
		left=SearchLeft(Num,temp);
		right=SearchRight(Num,temp);
		if(left==-1&&right==-1)
		{
			q[temp]=InsertLeftNode(root,point);
			Num[temp]=1;
		}
		else if(left!=-1&&q[left]->rightChild==NULL)
		{
			q[temp]=InsertRightNode(q[left],point);
			Num[temp]=1;
		}
		else if(right!=-1&&q[right]->leftChild==NULL)
		{
			q[temp]=InsertLeftNode(q[right],point);
			Num[temp]=1;
		}
	}
	PrintBiTree(root,0);
	printf("****************************************\n\n");
	printf("PreOrder: \t");
	PreOrder(root->leftChild,Visit);
	printf("\nInOrder:\t");
	InOrder(root->leftChild,Visit);
	printf("\nPostOrder: \t");
	PostOrder(root->leftChild,Visit);
	printf("\n*****************************************************************************\n\t\t\t\bCopyright @ 2009 Gary All Right Reserved\n");
	return 0;
}