DataView.IsEquivalent

Prototypes

static boolean IsEquivalent( DataView view1, DataView view2 )

Return Value

If the two variables refer to the same data view, the return value is true. If either variable is null or the variables refer to different data views, the return value is false.

Parameters

DataView view1
An object of a DataView-derived class.

DataView view2
An object of a DataView-derived class.

Remarks

Use this method to determine whether two objects of the DataView class refer to the same data view. This method is usually used in conjunction with the method DataView.GetInitiator to determine whether the initiator of an action is a particular known DataView.

Technical Note: This method does not return the same values as the Java method Object.equals. The DataView objects that an IMLPlus programmer manipulates are actually proxies for data views. It is possible to have multiple proxies that refer to the same data view.

Example
x = normal(j(100,1,12345));
declare Histogram hist1;
hist1 = Histogram.Create( "First Histogram", x );
hist1.SetTitleText( "First Histogram" );
hist1.ShowTitle();
hist1.AppendActionMenuItem( "Print Number of Actions",
    "run PrintNumActions;" );

declare Histogram hist2;
hist2 = Histogram.Create( "Second Histogram", x );
hist2.SetTitleText( "Second Histogram" );
hist2.ShowTitle();
hist2.AppendActionMenuItem( "Print Number of Actions",
    "run PrintNumActions;" );
numActions = {0 0};

start PrintNumActions;
    declare Plot initiator;
    initiator = DataView.GetInitiator();
    if DataView.IsEquivalent( hist1, initiator ) then
        numActions[1] = numActions[1] + 1;
    else if DataView.IsEquivalent( hist2, initiator ) then
        numActions[2] = numActions[2] + 1;

    reset noname;
    print "Number of times action menu has been chosen",
    numActions[c={"Hist1" "Hist2"}];
finish;
/* Press F11 in each plot window and select the menu item. */
See Also

DataView.GetInitiator
DataView.IsInstance