tracesrv/tracecompiler/src/com.nokia.tracecompiler/src/com/nokia/tracecompiler/source/SourceReturn.java
changeset 56 aa2539c91954
parent 41 838cdffd57ce
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 * Properties of function return statement
       
    17 *
       
    18 */
       
    19 package com.nokia.tracecompiler.source;
       
    20 
       
    21 /**
       
    22  * Properties of function return statement
       
    23  * 
       
    24  */
       
    25 public class SourceReturn extends SourceLocationBase {
       
    26 
       
    27 	/**
       
    28 	 * Previous character might cause a problem
       
    29 	 */
       
    30 	private boolean charHazard;
       
    31 
       
    32 	/**
       
    33 	 * The return statement itself might cause a problem
       
    34 	 */
       
    35 	private boolean tagHazard;
       
    36 
       
    37 	/**
       
    38 	 * Constructor
       
    39 	 * 
       
    40 	 * @param parser
       
    41 	 *            the parser owning this location
       
    42 	 * @param offset
       
    43 	 *            the offset to the beginning of return statement
       
    44 	 * @param length
       
    45 	 *            the return statement length
       
    46 	 */
       
    47 	SourceReturn(SourceParser parser, int offset, int length) {
       
    48 		super(parser, offset, length);
       
    49 	}
       
    50 
       
    51 	/**
       
    52 	 * Gets the return statement
       
    53 	 * 
       
    54 	 * @return the statement
       
    55 	 */
       
    56 	public String getReturnStatement() {
       
    57 		String retval = ""; //$NON-NLS-1$
       
    58 		if (getParser() != null) {
       
    59 			retval = getParser().getData(getOffset(), getLength());
       
    60 		}
       
    61 		return retval;
       
    62 	}
       
    63 
       
    64 	/**
       
    65 	 * Sets a flag which indicates that the character preceeding the return
       
    66 	 * statement might cause problems when a trace is added prior to the return
       
    67 	 * statement
       
    68 	 */
       
    69 	void setPreviousCharHazard() {
       
    70 		this.charHazard = true;
       
    71 	}
       
    72 
       
    73 	/**
       
    74 	 * Gets the flag which indicates if the character preceeding the return
       
    75 	 * statement might cause problems when a trace is added prior to the return
       
    76 	 * statement
       
    77 	 * 
       
    78 	 * @return the flag
       
    79 	 */
       
    80 	public boolean hasPreviousCharHazard() {
       
    81 		return charHazard;
       
    82 	}
       
    83 
       
    84 	/**
       
    85 	 * Sets a flag which indicates that the return statement might cause
       
    86 	 * problems when duplicated to a trace
       
    87 	 */
       
    88 	void setTagHazard() {
       
    89 		tagHazard = true;
       
    90 	}
       
    91 
       
    92 	/**
       
    93 	 * Gets the flag which indicates if the return statement might cause
       
    94 	 * problems when duplicated to a trace
       
    95 	 * 
       
    96 	 * @return the flag
       
    97 	 */
       
    98 	public boolean hasTagHazard() {
       
    99 		return tagHazard;
       
   100 	}
       
   101 
       
   102 }