public void CreateRepresentation( string text )
		{
			if( text.Length == 0 )
				return;

			this.TextLines = text.Split( new char[]{'\n' } );
			foreach( string rawLine in TextLines )
			{
				LineModel model = new LineModel( rawLine, m_inMultiLine );
				m_inMultiLine = model.InMultipleLineComment;

				if( model.HasIteration )
					this.NumIterationStmts++;
				if( model.HasConditional )
					this.NumConditionalStmts++;
				if( model.HasComment)
					this.NumComments++;

				Lines.Add( model );
			}
		}
		protected void CollectTemporaryFieldDefs( Hashtable htDefs, Hashtable htUses, MethodComponent m, LineModel line, string strLine )
		{
			if( line.HasCode && line.HasAssignment )
			{
				foreach( FieldComponent tempfield in htUses.Keys )
				{
					int idx = strLine.IndexOf( tempfield.Name );
					if( idx > -1 && idx < strLine.IndexOf("=") )
					{
						if( htDefs[ tempfield ] == null )
						{
							htDefs[ tempfield ] = new ArrayList();
						}
						if( ! ((ArrayList)htDefs[ tempfield ] ).Contains( m ) )
						{
							((ArrayList)htDefs[ tempfield ]).Add( m );
						}
					}
				}
			}
		}
		protected void CollectTemporaryFieldUses( Hashtable htUses, ClassComponent cls, MethodComponent m, LineModel line, string strLine )
		{
			if( line.HasConditional )
			{
				foreach( FieldComponent field in cls.Fields )
				{
					if( strLine.IndexOf( field.Name ) > -1)
					{
						if( htUses[ field ] == null )
						{
							htUses[ field ] = new ArrayList();
						}
						if( ! ((ArrayList)htUses[ field ]).Contains( m ) )
						{
							((ArrayList)htUses[ field ]).Add( m );
						}
					}
				}
			}
		}
Beispiel #4
0
		protected Pen GetPen( LineModel model )
		{
			if( model.HasComment )
				return Pens.LightGreen;
			if( model.HasIteration )
				return Pens.LightBlue;
			if( model.HasConditional )
				return Pens.Blue;
			return null;
		}