/** Instances of <code>PointerType</code> with identical pointers compare * equal by default. */ @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof PointerType) { Pointer p = ((PointerType)o).getPointer(); if (pointer == null) { return p == null; } return pointer.equals(p); } return false; }
/** * @return whether the given structure's type and pointer match. */ @Override public boolean equals(Object o) { return o instanceof Structure && o.getClass() == getClass() && ((Structure)o).getPointer().equals(getPointer()); }
private int indexOf(Structure s1) { for (int i=0;i < count;i++) { Structure s2 = elements[i]; if (s1 == s2 || (s1.getClass() == s2.getClass() && s1.size() == s2.size() && s1.getPointer().equals(s2.getPointer()))) { return i; } } return -1; } @Override
/** Only keep the original structure if its native address is unchanged. * Otherwise replace it with a new object. * @param type Structure subclass * @param s Original Structure object * @param address the native <code>struct *</code> * @return Updated <code>Structure.ByReference</code> object */ static <T extends Structure> T updateStructureByReference(Class<T> type, T s, Pointer address) { if (address == null) { s = null; } else { if (s == null || !address.equals(s.getPointer())) { Structure s1 = reading().get(address); if (s1 != null && type.equals(s1.getClass())) { s = (T) s1; s.autoRead(); } else { s = newInstance(type, address); s.conditionalAutoRead(); } } else { s.autoRead(); } } return s; }
Callback cb = (Callback)currentValue; Pointer oldfp = CallbackReference.getFunctionPointer(cb); if (!fp.equals(oldfp)) { cb = CallbackReference.getCallback(type, fp); Pointer oldbp = currentValue == null ? null : Native.getDirectBufferPointer((Buffer)currentValue); if (oldbp == null || !oldbp.equals(bp)) { throw new IllegalStateException("Can't autogenerate a direct buffer on memory read");
@Override public boolean equals(Object other) { return other instanceof JSObject && value.equals(((JSObject)other).value); } }
@Override public boolean equals(Object obj) { if (!(obj instanceof JnaJobTemplate)) return false; JnaJobTemplate other = (JnaJobTemplate) obj; return this.jt.equals(other.jt) && this.session.equals(other.session); }
public void callback(Pointer self, Pointer selector) { if (selector.equals(settingsMenuRegister)) { for (SettingsHandler q : new ArrayList<SettingsHandler>(st)) { q.showSettingsMenu(); } } } };
public int callback(Pointer self, Pointer selector, Pointer sender) { if (selector.equals(registerApplicationShouldTerminateSelector)) { for (QuitHandler q : new ArrayList<QuitHandler>(quit)) { q.handleQuit(); } } return NSApplicationTerminateReply.NSTerminateNow; } };
/** Instances of <code>PointerType</code> with identical pointers compare * equal by default. */ public boolean equals(Object o) { if (o instanceof PointerType) { Pointer p = ((PointerType)o).getPointer(); if (pointer == null) return p == null; return pointer.equals(p); } return false; } }
public void callback(Pointer self, Pointer selector) { if (selector.equals(aboutMenuRegister)) { for (AboutHandler q : new ArrayList<AboutHandler>(ab)) { q.showAboutMenu(); } } } };
public boolean callback(Pointer self, Pointer selector, Pointer app, Pointer file) { if (selector.equals(applicationOpenFile)) { for (OpenFileHandler q : new ArrayList<OpenFileHandler>(files)) { q.openFile(new File(file.toString())); } } return true; } };
public void callback(Pointer self, Pointer selector) { if (selector.equals(registerActionSelector)) { OSXSysTrayAction a = map.get(Pointer.nativeValue(self)); a.mi.doClick(); } } };
/** * @return whether the given structure's type and pointer match. */ @Override public boolean equals(Object o) { return o instanceof Structure && o.getClass() == getClass() && ((Structure)o).getPointer().equals(getPointer()); }
private void checkHandleValidity(HANDLE handle) { if (NuWinNT.INVALID_HANDLE_VALUE.getPointer().equals(handle)) { throw new RuntimeException("Unable to create pipe, error " + Native.getLastError()); } }
/** {@inheritDoc} */ @Override public void wantWrite() { if (hStdinWidow != null && !NuWinNT.INVALID_HANDLE_VALUE.getPointer().equals(hStdinWidow.getPointer())) { userWantsWrite.set(true); myProcessor.wantWrite(this); } }
public boolean callback(Pointer self, Pointer selector, Pointer app, Pointer file) { if (selector.equals(applicationOpenFileNo)) { for (OpenFileHandler q : new ArrayList<OpenFileHandler>(files)) { q.openFile(new File(new NSString(file).toString())); } } return true; } };
public void busMessage(Bus b, Message message) { if (message.getSource().getNativeAddress().equals(getNativeAddress())) { final Structure structure = message.getStructure(); if (structure != null && "have-ns-view".equals(structure.getName())) { final Pointer nsview = (Pointer) structure.getValue("nsview"); fireNewVideoComponent(nsview); } } } });
public HKEY getValue() { Pointer p = getPointer().getPointer(0); if (p == null) return null; if (WinBase.INVALID_HANDLE_VALUE.getPointer().equals(p)) return (HKEY) WinBase.INVALID_HANDLE_VALUE; HKEY h = new HKEY(); h.setPointer(p); return h; } }
public HKEY getValue() { Pointer p = getPointer().getPointer(0); if (p == null) return null; if (WinBase.INVALID_HANDLE_VALUE.getPointer().equals(p)) return (HKEY) WinBase.INVALID_HANDLE_VALUE; HKEY h = new HKEY(); h.setPointer(p); return h; } }