trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeBaseItem.java
changeset 11 5b9d4d8641ce
equal deleted inserted replaced
10:ed1c9f64298a 11:5b9d4d8641ce
       
     1 /*
       
     2  * Copyright (c) 2007-2010 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  * VariableTracing Tree Base item class
       
    17  *
       
    18  */
       
    19 package com.nokia.traceviewer.dialog.treeitem;
       
    20 
       
    21 /**
       
    22  * VariableTracing Tree Base item class
       
    23  */
       
    24 public class VariableTracingTreeBaseItem extends TreeItemImpl implements
       
    25 		VariableTracingTreeItem {
       
    26 
       
    27 	/**
       
    28 	 * Rule of the item
       
    29 	 */
       
    30 	private final Rule rule;
       
    31 
       
    32 	/**
       
    33 	 * Number of historyItems to save
       
    34 	 */
       
    35 	private final int historyCount;
       
    36 
       
    37 	/**
       
    38 	 * Constructor
       
    39 	 * 
       
    40 	 * @param listener
       
    41 	 *            TreeItemListener
       
    42 	 * @param parent
       
    43 	 *            parent object
       
    44 	 * @param name
       
    45 	 *            name of the item
       
    46 	 * @param rule
       
    47 	 *            rule for the item
       
    48 	 * @param historyCount
       
    49 	 *            count for the item
       
    50 	 */
       
    51 	public VariableTracingTreeBaseItem(TreeItemListener listener,
       
    52 			Object parent, String name, Rule rule, int historyCount) {
       
    53 		super(name, parent, listener, (rule == Rule.GROUP));
       
    54 		this.rule = rule;
       
    55 		this.historyCount = historyCount;
       
    56 
       
    57 		// Always save at least 1
       
    58 		if (historyCount < 1) {
       
    59 			historyCount = 1;
       
    60 		}
       
    61 	}
       
    62 
       
    63 	/**
       
    64 	 * Constructor without history count
       
    65 	 * 
       
    66 	 * @param listener
       
    67 	 *            TreeItemListener
       
    68 	 * @param parent
       
    69 	 *            parent object
       
    70 	 * @param name
       
    71 	 *            name of the item
       
    72 	 * @param rule
       
    73 	 *            rule for the item
       
    74 	 */
       
    75 	public VariableTracingTreeBaseItem(TreeItemListener listener,
       
    76 			Object parent, String name, Rule rule) {
       
    77 		super(name, parent, listener, (rule == Rule.GROUP));
       
    78 		this.rule = rule;
       
    79 		this.historyCount = 1;
       
    80 	}
       
    81 
       
    82 	/**
       
    83 	 * Gets the type of the rule
       
    84 	 * 
       
    85 	 * @return the rule
       
    86 	 */
       
    87 	public Rule getRule() {
       
    88 		return rule;
       
    89 	}
       
    90 
       
    91 	/**
       
    92 	 * Gets history count
       
    93 	 * 
       
    94 	 * @return the historyCount
       
    95 	 */
       
    96 	public int getHistoryCount() {
       
    97 		return historyCount;
       
    98 	}
       
    99 }