Relation(Accessible accessible, int type) { this.accessible = accessible; this.type = type; this.targets = new Accessible[0]; AddRef(); }
@Override public int /*long*/ method1(int /*long*/[] args) {return AddRef();} @Override
int get_relation(int relationIndex, int /*long*/ ppRelation) { int i = -1; for (int type = 0; type < MAX_RELATION_TYPES; type++) { Relation relation = relations[type]; if (relation != null) i++; if (i == relationIndex) { if (DEBUG) print(this + ".IAccessible2::get_relation(" + relationIndex + ") returning " + relation.getAddress() + hresult(COM.S_OK)); relation.AddRef(); COM.MoveMemory(ppRelation, new int /*long*/[] { relation.getAddress() }, OS.PTR_SIZEOF); return COM.S_OK; } } if (DEBUG) print(this + ".IAccessible2::get_relation(" + relationIndex + ") returning" + hresult(COM.E_INVALIDARG)); return COM.E_INVALIDARG; }
int get_relations(int maxRelations, int /*long*/ ppRelations, int /*long*/ pNRelations) { int count = 0; for (int type = 0; type < MAX_RELATION_TYPES; type++) { if (count == maxRelations) break; Relation relation = relations[type]; if (relation != null) { relation.AddRef(); COM.MoveMemory(ppRelations + count * OS.PTR_SIZEOF, new int /*long*/[] { relation.getAddress() }, OS.PTR_SIZEOF); count++; } } if (DEBUG) print(this + ".IAccessible2::get_relations(" + maxRelations + ") returning " + count + hresult(COM.S_OK)); COM.MoveMemory(pNRelations, new int [] { count }, 4); return COM.S_OK; }
int QueryInterface(int /*long*/ iid, int /*long*/ ppvObject) { GUID guid = new GUID(); COM.MoveMemory(guid, iid, GUID.sizeof); if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIAccessibleRelation)) { COM.MoveMemory(ppvObject, new int /*long*/[] { getAddress() }, OS.PTR_SIZEOF); AddRef(); return COM.S_OK; } return COM.E_NOINTERFACE; }