trace/tracebuilder/com.nokia.tracebuilder/src/com/nokia/tracebuilder/engine/TraceLocationProperties.java
changeset 10 ed1c9f64298a
equal deleted inserted replaced
9:14dc2103a631 10:ed1c9f64298a
       
     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 * Optional properties for a trace location
       
    17 *
       
    18 */
       
    19 package com.nokia.tracebuilder.engine;
       
    20 
       
    21 import java.util.ArrayList;
       
    22 import java.util.Collections;
       
    23 import java.util.Iterator;
       
    24 import java.util.List;
       
    25 
       
    26 import com.nokia.tracebuilder.engine.source.SourceLocationRule;
       
    27 import com.nokia.tracebuilder.engine.source.TraceFormattingRule;
       
    28 
       
    29 /**
       
    30  * Optional properties for a trace location
       
    31  * 
       
    32  */
       
    33 public class TraceLocationProperties {
       
    34 
       
    35 	/**
       
    36 	 * Formatting rule for the location
       
    37 	 */
       
    38 	private TraceFormattingRule formatRule;
       
    39 
       
    40 	/**
       
    41 	 * Location rule for the location
       
    42 	 */
       
    43 	private SourceLocationRule locationRule;
       
    44 
       
    45 	/**
       
    46 	 * Tags to be added to source as parameters instead of parameter name
       
    47 	 */
       
    48 	private ArrayList<String> parameterTags;
       
    49 
       
    50 	/**
       
    51 	 * View reference for quick view updates
       
    52 	 */
       
    53 	private Object viewReference;
       
    54 
       
    55 	/**
       
    56 	 * Event view reference for quick event view updates
       
    57 	 */
       
    58 	private Object eventViewReference;
       
    59 
       
    60 	/**
       
    61 	 * Gets the location rule
       
    62 	 * 
       
    63 	 * @return the location rule
       
    64 	 */
       
    65 	public SourceLocationRule getLocationRule() {
       
    66 		return locationRule;
       
    67 	}
       
    68 
       
    69 	/**
       
    70 	 * Sets a location rule for the location. The rule overrides the default
       
    71 	 * location rule provided by the trace that owns the location
       
    72 	 * 
       
    73 	 * @param rule
       
    74 	 *            the location formatting rule
       
    75 	 */
       
    76 	public void setLocationRule(SourceLocationRule rule) {
       
    77 		this.locationRule = rule;
       
    78 	}
       
    79 
       
    80 	/**
       
    81 	 * Gets the formatting rule
       
    82 	 * 
       
    83 	 * @return the formatting rule
       
    84 	 */
       
    85 	public TraceFormattingRule getFormatRule() {
       
    86 		return formatRule;
       
    87 	}
       
    88 
       
    89 	/**
       
    90 	 * Sets a formatting rule for the location. The formatting rule overrides
       
    91 	 * the formatting rule provided by the trace that owns the location
       
    92 	 * 
       
    93 	 * @param rule
       
    94 	 *            the location formatting rule
       
    95 	 */
       
    96 	public void setFormatRule(TraceFormattingRule rule) {
       
    97 		this.formatRule = rule;
       
    98 	}
       
    99 
       
   100 	/**
       
   101 	 * Gets the parameter tags for this location. This works based on parameter
       
   102 	 * index
       
   103 	 * 
       
   104 	 * @return the list of parameter tags for the location
       
   105 	 */
       
   106 	public Iterator<String> getParameterTags() {
       
   107 		List<String> list;
       
   108 		if (parameterTags != null) {
       
   109 			list = parameterTags;
       
   110 		} else {
       
   111 			list = Collections.emptyList();
       
   112 		}
       
   113 		return list.iterator();
       
   114 	}
       
   115 
       
   116 	/**
       
   117 	 * Adds a new parameter tag to this location
       
   118 	 * 
       
   119 	 * @param tag
       
   120 	 *            the tag to be added
       
   121 	 */
       
   122 	public void addParameterTag(String tag) {
       
   123 		if (parameterTags == null) {
       
   124 			parameterTags = new ArrayList<String>();
       
   125 		}
       
   126 		parameterTags.add(tag);
       
   127 	}
       
   128 
       
   129 	/**
       
   130 	 * Sets the view reference
       
   131 	 * 
       
   132 	 * @param viewReference
       
   133 	 *            the view reference
       
   134 	 */
       
   135 	public void setViewReference(Object viewReference) {
       
   136 		this.viewReference = viewReference;
       
   137 	}
       
   138 
       
   139 	/**
       
   140 	 * Gets the view reference of the location
       
   141 	 * 
       
   142 	 * @return the view reference
       
   143 	 */
       
   144 	public Object getViewReference() {
       
   145 		return viewReference;
       
   146 	}
       
   147 
       
   148 	/**
       
   149 	 * Sets the event view reference
       
   150 	 * 
       
   151 	 * @param eventViewReference
       
   152 	 *            the event view reference
       
   153 	 */
       
   154 	public void setEventViewReference(Object eventViewReference) {
       
   155 		this.eventViewReference = eventViewReference;
       
   156 	}
       
   157 
       
   158 	/**
       
   159 	 * Gets the event view reference of the location
       
   160 	 * 
       
   161 	 * @return the event view reference
       
   162 	 */
       
   163 	public Object getEventViewReference() {
       
   164 		return eventViewReference;
       
   165 	}
       
   166 
       
   167 }