sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/internal/pi/wizards/model/TraceFile.java
changeset 12 ae255c9aa552
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
       
     1 /*
       
     2  * Copyright (c) 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 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 package com.nokia.carbide.cpp.internal.pi.wizards.model;
       
    18 
       
    19 import java.io.Serializable;
       
    20 
       
    21 import org.eclipse.core.runtime.IPath;
       
    22 import org.eclipse.core.runtime.Path;
       
    23 
       
    24 public class TraceFile implements Serializable {
       
    25 
       
    26 	private static final long serialVersionUID = 8762830613454627945L;
       
    27 
       
    28 	private String traceFilePath;
       
    29 	private String projectName;
       
    30 	private String sdkName;
       
    31 	private long importTime;
       
    32 	private long traceFileSize;
       
    33 	private long traceLengthInTime;
       
    34 	private int[] pluginIds;
       
    35 
       
    36 	/**
       
    37 	 * Constructor
       
    38 	 * 
       
    39 	 * @param traceFilePath location of the trace file
       
    40 	 * @param projectName trace file is imported under the given project name
       
    41 	 * @param sdkName SDK name
       
    42 	 * @param traceFileSize size of the trace file
       
    43 	 * @param traceLengthInTime trace time of the trace file
       
    44 	 * @param pluginIds list of the plugin's id
       
    45 	 */	
       
    46 	public TraceFile(IPath traceFilePath, String projectName, String sdkName, long traceFileSize, long traceLengthInTime, int[] pluginIds) {
       
    47 		this.traceFilePath = traceFilePath.toOSString();
       
    48 		this.projectName = projectName;
       
    49 		this.sdkName = sdkName;
       
    50 		this.importTime = System.currentTimeMillis();
       
    51 		this.traceFileSize = traceFileSize;
       
    52 		this.traceLengthInTime = traceLengthInTime;
       
    53 		this.pluginIds = pluginIds;
       
    54 	}
       
    55 
       
    56 	/**
       
    57 	 * @return the traceFilePath
       
    58 	 */
       
    59 	public IPath getTraceFilePath() {
       
    60 		return new Path(traceFilePath);
       
    61 	}
       
    62 
       
    63 	/**
       
    64 	 * @param traceFilePath
       
    65 	 *            the traceFilePath to set
       
    66 	 */
       
    67 	public void setTraceFilePath(IPath traceFilePath) {
       
    68 		this.traceFilePath = traceFilePath.toString();
       
    69 	}
       
    70 
       
    71 	/**
       
    72 	 * @return the projectName
       
    73 	 */
       
    74 	public String getProjectName() {
       
    75 		return projectName;
       
    76 	}
       
    77 
       
    78 	/**
       
    79 	 * @param projectName
       
    80 	 *            the projectName to set
       
    81 	 */
       
    82 	public void setProjectName(String projectName) {
       
    83 		this.projectName = projectName;
       
    84 	}
       
    85 
       
    86 	/**
       
    87 	 * @return the sdkName
       
    88 	 */
       
    89 	public String getSdkName() {
       
    90 		return sdkName;
       
    91 	}
       
    92 
       
    93 	/**
       
    94 	 * @param sdkName
       
    95 	 *            the sdkName to set
       
    96 	 */
       
    97 	public void setSdkName(String sdkName) {
       
    98 		this.sdkName = sdkName;
       
    99 	}
       
   100 
       
   101 	/**
       
   102 	 * @return the importTime
       
   103 	 */
       
   104 	public long getImportTime() {
       
   105 		return importTime;
       
   106 	}
       
   107 
       
   108 	/**
       
   109 	 * @param importTime
       
   110 	 *            the importTime to set
       
   111 	 */
       
   112 	public void setImportTime(long importTime) {
       
   113 		this.importTime = importTime;
       
   114 	}
       
   115 
       
   116 	/**
       
   117 	 * @return the traceFileSize
       
   118 	 */
       
   119 	public long getTraceFileSize() {
       
   120 		return traceFileSize;
       
   121 	}
       
   122 
       
   123 	/**
       
   124 	 * @param traceFileSize
       
   125 	 *            the traceFileSize to set
       
   126 	 */
       
   127 	public void setTraceFileSize(long traceFileSize) {
       
   128 		this.traceFileSize = traceFileSize;
       
   129 	}
       
   130 
       
   131 	/**
       
   132 	 * @return the traceLengthInTime
       
   133 	 */
       
   134 	public long getTraceLengthInTime() {
       
   135 		return traceLengthInTime;
       
   136 	}
       
   137 
       
   138 	/**
       
   139 	 * @param traceLengthInTime
       
   140 	 *            the traceLengthInTime to set
       
   141 	 */
       
   142 	public void setTraceLengthInTime(long traceLengthInTime) {
       
   143 		this.traceLengthInTime = traceLengthInTime;
       
   144 	}
       
   145 	
       
   146 	/**
       
   147 	 * @return the pluginIds
       
   148 	 */
       
   149 	public int[] getPluginIds() {
       
   150 		return pluginIds;
       
   151 	}
       
   152 
       
   153 	/**
       
   154 	 * @param pluginIds the pluginIds to set
       
   155 	 */
       
   156 	public void setPluginIds(int[] pluginIds) {
       
   157 		this.pluginIds = pluginIds;
       
   158 	}
       
   159 
       
   160 	/**
       
   161 	 * Checks if trace files are equal. Two trace files are equal if
       
   162 	 * their path is the same
       
   163 	 */
       
   164 	public boolean equals(Object other) {
       
   165 		if (this == other)
       
   166 			return true;
       
   167 		
       
   168 		if (!(other instanceof TraceFile))
       
   169 			return false;
       
   170 		
       
   171 		TraceFile othr = (TraceFile)other;
       
   172 		return this.getTraceFilePath().equals(othr.getTraceFilePath());	
       
   173 	}
       
   174 
       
   175 }