Statistics
| Branch: | Revision:

root / src / org.omnetpp.ide.nativelibs / idlist.i @ 0418c1a0

History | View | Annotate | Download (2.32 KB)

1
%ignore IDList::IDList(unsigned int);
2
%ignore IDList::IDList(const IDList&);
3

    
4
%ignore IDList::clear;
5
%ignore IDList::set(const IDList&);
6
%ignore IDList::erase;
7
%ignore IDList::dup;
8
%ignore IDList::sortByFileAndRun;
9
%ignore IDList::sortByRunAndFile;
10
%ignore IDList::getItemTypes;
11
%ignore IDList::reverse;
12
%ignore IDList::toByteArray;
13
%ignore IDList::fromByteArray;
14
%ignore IDList::getSubsetByIndeces;
15

    
16

    
17
%typemap(javaimports) IDList %{
18
import java.util.ArrayList;
19
import java.util.EventListener;
20
%}
21

    
22

    
23
%typemap(javacode) IDList %{
24

    
25
  public static interface IChangeListener extends EventListener {
26
	public void idlistChanged(IDList idlist);
27
  }
28

    
29
  private ArrayList<IChangeListener> listeners = new ArrayList<IChangeListener>();
30

    
31
  // TODO ensure that immutable
32
  public static final IDList EMPTY = new IDList();
33

    
34
  public void addListener(IChangeListener listener) {
35
  	listeners.add(listener);
36
  }
37

    
38
  public void removeListener(IChangeListener listener) {
39
  	listeners.remove(listener);
40
  }
41

    
42
  protected void notifyListeners() {
43
  	for (IChangeListener listener : listeners.toArray(new IChangeListener[listeners.size()]))
44
  		listener.idlistChanged(this);
45
  }
46

    
47
  public void swigDisown() {
48
      swigCMemOwn = false;
49
  }
50

    
51
  public static IDList fromArray(Long[] array) {
52
      IDList list = new IDList();
53
      for (int i=0; i<array.length; i++)
54
          list.add(array[i].longValue());
55
      return list;
56
  }
57

    
58
  public Long[] toArray() {
59
      int sz = (int) size();
60
      Long[] array = new Long[sz];
61
      for (int i=0; i<sz; i++)
62
          array[i] = Long.valueOf(get(i));
63
      return array;
64
  }
65
%}
66

    
67
%define ADD_NOTIFY(METHOD)
68
%typemap(javaout) void IDList::METHOD {
69
    $jnicall;
70
    notifyListeners();
71
  }
72
%enddef
73

    
74
ADD_NOTIFY(add);
75
ADD_NOTIFY(intersect);
76
ADD_NOTIFY(merge);
77
ADD_NOTIFY(substract);
78
ADD_NOTIFY(sortByDirectory);
79
ADD_NOTIFY(sortByFileName);
80
ADD_NOTIFY(sortByModule);
81
ADD_NOTIFY(sortByName);
82
ADD_NOTIFY(sortByRun);
83
ADD_NOTIFY(sortScalarsByValue);
84
ADD_NOTIFY(sortVectorsByLength);
85
ADD_NOTIFY(sortVectorsByMean);
86
ADD_NOTIFY(sortVectorsByStdDev);
87
ADD_NOTIFY(sortVectorsByVectorId);
88
ADD_NOTIFY(sortVectorsByMin);
89
ADD_NOTIFY(sortVectorsByMax);
90
ADD_NOTIFY(sortVectorsByStartTime);
91
ADD_NOTIFY(sortVectorsByEndTime);
92
ADD_NOTIFY(sortByRunAttribute);
93

    
94
%include "idlist.h"