srcanaapps/depexplorer/com.nokia.s60tools.appdep/src/com/nokia/s60tools/appdep/core/model/ImportFunctionData.java
author noe\swadi
Sat, 09 Jan 2010 10:04:11 +0530
changeset 0 a02c979e8dfd
permissions -rw-r--r--
1. Copyrights changed to EPL 2. Feature updates mentioned in release notes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     1
/*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     3
* All rights reserved.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     4
* This component and the accompanying materials are made available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     6
* which accompanies this distribution, and is available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     8
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     9
* Initial Contributors:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    11
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    12
* Contributors:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    13
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    14
* Description:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    15
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    16
*/
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    17
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    18
package com.nokia.s60tools.appdep.core.model;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    19
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    20
import com.nokia.s60tools.appdep.exceptions.ZeroFunctionOrdinalException;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    21
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    22
/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    23
 * Data placeholder for import function data.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    24
 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    25
public class ImportFunctionData extends AbstractFunctionData{
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    26
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    27
	//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    28
	// These indexes are used to access cache data
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    29
	//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    30
	public static final int ORDINAL_FIELD_INDEX = 0; // This field count is to access cache data file
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    31
	public static final int NAME_FIELD_INDEX = 1; // This field count is to access cache data file
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    32
	public static final int ISVIRTUAL_FIELD_INDEX = 2; // This field count is to access cache data file
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    33
	public static final int OFFSET_FIELD_INDEX = 3; // This field count is to access cache data file
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    34
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    35
	//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    36
	// NOTE: Column indeces must start from zero (0) and
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    37
	// the columns must be added in ascending numeric
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    38
	// order.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    39
	//
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    40
	public static final int ORDINAL_COLUMN_INDEX = 0; // This field count is for UI
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    41
	public static final int NAME_COLUMN_INDEX = 1; // This field count is for UI
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    42
	public static final int OFFSET_COLUMN_INDEX = 2; // This field count is for UI
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    43
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    44
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    45
	 * <code>true</code> if function is virtual, otherwise <code>false</code>.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    46
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    47
	private final boolean isVirtual;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    48
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    49
	 * Function offset.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    50
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    51
	private final String functionOffset;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    52
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    53
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    54
	 * Constructor.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    55
	 * @param functionOrdinal Function ordinal (1..n when converted into integer).
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    56
	 * @param functionName Function name.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    57
	 * @param isVirtual <code>true</code> if function is virtual, otherwise <code>false</code>.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    58
	 * @param functionOffset Function offset.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    59
	 * @throws IllegalArgumentException
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    60
	 * @throws ZeroFunctionOrdinalException 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    61
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    62
	public ImportFunctionData(String functionOrdinal, String functionName, boolean isVirtual, String functionOffset) throws IllegalArgumentException, ZeroFunctionOrdinalException{
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    63
		super(functionOrdinal, functionName);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    64
		this.isVirtual = isVirtual;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    65
		this.functionOffset = functionOffset;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    66
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    67
	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    68
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    69
	 * Checks if function is virtual of not.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    70
	 * @return <code>true</code> in case is virtual, otherwise <code>false</code>.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    71
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    72
	public boolean isVirtual() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    73
		return isVirtual;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    74
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    75
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    76
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    77
	 * Gets function offset 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    78
	 * @return the functionOffset
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    79
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    80
	public int getFunctionOffset() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    81
		return Integer.parseInt(functionOffset);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    82
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    83
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    84
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    85
	 * Getting string representation for function offset. Only valid for virtual functions.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    86
	 * @return the functionOffset
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    87
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    88
	public String getFunctionOffsetAsString() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    89
		// Returning empty string for non-virtual function that do not really have offset.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    90
		if(!isVirtual()){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    91
			return ""; //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    92
		}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    93
		return functionOffset;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    94
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    95
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    96
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    97
	 * Sets function name for the given imported function data.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    98
	 * This is needed in order to set function name in case it is resolved
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    99
	 * later on by help of the user interaction that provides additional
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   100
	 * information.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   101
	 * @param functionName Function name to be set.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   102
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   103
	public void setFunctionName(String functionName) {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   104
		this.functionName = functionName;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   105
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   106
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
   107
}