sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/model/ProfiledFunction.java
changeset 2 b9ab3b238396
child 5 844b047e260d
equal deleted inserted replaced
1:1050670c6980 2:b9ab3b238396
       
     1 /*
       
     2  * Copyright (c) 2009 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 the License "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  */
       
    17 
       
    18 package com.nokia.carbide.cpp.internal.pi.model;
       
    19 
       
    20 import java.util.Vector;
       
    21 
       
    22 public class ProfiledFunction extends ProfiledGeneric
       
    23 {
       
    24 	long   functionAddress;
       
    25     String functionBinaryName;
       
    26 //	String functionBinaryPathName;
       
    27     Vector threadIds;
       
    28     
       
    29     public ProfiledFunction()
       
    30     {
       
    31         super();
       
    32         this.threadIds = new Vector();
       
    33         //setEnabled(false);
       
    34     }
       
    35     /**
       
    36      * @return Returns the functionAddress.
       
    37      */
       
    38     public long getFunctionAddress()
       
    39     {
       
    40         return functionAddress;
       
    41     }
       
    42 
       
    43     /**
       
    44      * @param functionAddress The functionAddress to set.
       
    45      */
       
    46     public void setFunctionAddress(long functionAddress)
       
    47     {
       
    48         this.functionAddress = functionAddress;
       
    49     }
       
    50 
       
    51     /**
       
    52      * @return Returns the functionBinaryName.
       
    53      */
       
    54     public String getFunctionBinaryName()
       
    55     {
       
    56         //return this.nameString;
       
    57         return functionBinaryName;
       
    58     }
       
    59 
       
    60     /**
       
    61      * @param functionBinaryName The functionBinaryName to set.
       
    62      */
       
    63     public void setFunctionBinaryName(String functionBinaryName)
       
    64     {
       
    65         //this.nameString = functionBinaryName;
       
    66         this.functionBinaryName = functionBinaryName;
       
    67     }
       
    68 //
       
    69 //    public String getFunctionBinaryPathName()
       
    70 //    {
       
    71 //        //return this.nameString;
       
    72 //        return functionBinaryPathName;
       
    73 //    }
       
    74 //
       
    75 //    public void setFunctionBinaryPathName(String functionBinaryPathName)
       
    76 //    {
       
    77 //        //this.nameString = functionBinaryName;
       
    78 //        this.functionBinaryPathName = functionBinaryPathName;
       
    79 //    }
       
    80     
       
    81     public void addThreadId(int id)
       
    82     {
       
    83     	Integer integer = new Integer(id);
       
    84     	if (!this.threadIds.contains(integer))
       
    85     	{
       
    86     		this.threadIds.add(integer);
       
    87     	}
       
    88     }
       
    89     
       
    90     public boolean containsThreadId(int id)
       
    91     {
       
    92     	return this.threadIds.contains(new Integer(id));
       
    93     }
       
    94 
       
    95     public boolean equals(Object anObject)
       
    96     {
       
    97         if (anObject == null)
       
    98             return false;
       
    99         if (!(anObject instanceof ProfiledFunction))
       
   100             return false;
       
   101         ProfiledFunction pfTmp = (ProfiledFunction)anObject;
       
   102         if (this.getNameString().equals(pfTmp.getNameString()))
       
   103             return true;
       
   104         else
       
   105             return false;
       
   106     }
       
   107     
       
   108     public int hashCode()
       
   109     {
       
   110     	return this.getNameString().hashCode();
       
   111     }
       
   112     
       
   113     public String toString(int graphIndex)
       
   114     {
       
   115     	if (this.isEnabled(graphIndex))
       
   116     	{
       
   117     		return "true  " + this.getAverageLoadValueString(graphIndex) + getNameString(); //$NON-NLS-1$
       
   118 	  	}
       
   119 		else
       
   120 		{
       
   121 	      	return "false " + this.getAverageLoadValueString(graphIndex) + getNameString(); //$NON-NLS-1$
       
   122 		}
       
   123     }   
       
   124 }