本文整理了Java中org.eclipse.jface.util.Util.equals()
方法的一些代码示例,展示了Util.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.equals()
方法的具体详情如下:
包路径:org.eclipse.jface.util.Util
类名称:Util
方法名:equals
[英]Checks whether the two objects are null
-- allowing for null
.
[中]检查这两个对象是否为[$0$]--允许null
。
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public final boolean equals(final Object object) {
// Check if they're the same.
if (object == this) {
return true;
}
// Check if they're the same type.
if (!(object instanceof TriggerSequence)) {
return false;
}
final TriggerSequence triggerSequence = (TriggerSequence) object;
return Util.equals(triggers, triggerSequence.triggers);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
public boolean equals(final Object object) {
if (object instanceof TreeNode) {
return Util.equals(this.value, ((TreeNode) object).value);
}
return false;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public boolean equals(final Object object) {
if (object instanceof TreeNode) {
return Util.equals(this.value, ((TreeNode) object).value);
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
public final boolean equals(final Object object) {
// Check if they're the same.
if (object == this) {
return true;
}
// Check if they're the same type.
if (!(object instanceof TriggerSequence)) {
return false;
}
final TriggerSequence triggerSequence = (TriggerSequence) object;
return Util.equals(triggers, triggerSequence.triggers);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Compares this binding set with another object. The objects will be equal
* if they are both instance of <code>CachedBindingSet</code> and have
* equivalent values for all of their properties.
*
* @param object
* The object with which to compare; may be <code>null</code>.
* @return <code>true</code> if they are both instances of
* <code>CachedBindingSet</code> and have the same values for all
* of their properties; <code>false</code> otherwise.
*/
public final boolean equals(final Object object) {
if (!(object instanceof CachedBindingSet)) {
return false;
}
final CachedBindingSet other = (CachedBindingSet) object;
if (!Util.equals(activeContextTree, other.activeContextTree)) {
return false;
}
if (!Util.equals(locales, other.locales)) {
return false;
}
if (!Util.equals(platforms, other.platforms)) {
return false;
}
return Util.equals(schemeIds, other.schemeIds);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Checks whether the second array is a subsequence of the first array, and
* that they share common starting elements.
*
* @param left
* The first array to compare (large); may be <code>null</code>.
* @param right
* The second array to compare (small); may be <code>null</code>.
* @param equals
* Whether it is allowed for the two arrays to be equivalent.
* @return <code>true</code> if the first arrays starts with the second
* list; <code>false</code> otherwise.
*/
public static final boolean startsWith(final Object[] left,
final Object[] right, final boolean equals) {
if (left == null || right == null) {
return false;
}
int l = left.length;
int r = right.length;
if (r > l || !equals && r == l) {
return false;
}
for (int i = 0; i < r; i++) {
if (!equals(left[i], right[i])) {
return false;
}
}
return true;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Checks whether the second array is a subsequence of the first array, and
* that they share common starting elements.
*
* @param left
* The first array to compare (large); may be <code>null</code>.
* @param right
* The second array to compare (small); may be <code>null</code>.
* @param equals
* Whether it is allowed for the two arrays to be equivalent.
* @return <code>true</code> if the first arrays starts with the second
* list; <code>false</code> otherwise.
*/
public static final boolean startsWith(final Object[] left,
final Object[] right, final boolean equals) {
if (left == null || right == null) {
return false;
}
int l = left.length;
int r = right.length;
if (r > l || !equals && r == l) {
return false;
}
for (int i = 0; i < r; i++) {
if (!equals(left[i], right[i])) {
return false;
}
}
return true;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Compares this binding set with another object. The objects will be equal
* if they are both instance of <code>CachedBindingSet</code> and have
* equivalent values for all of their properties.
*
* @param object
* The object with which to compare; may be <code>null</code>.
* @return <code>true</code> if they are both instances of
* <code>CachedBindingSet</code> and have the same values for all
* of their properties; <code>false</code> otherwise.
*/
@Override
public final boolean equals(final Object object) {
if (!(object instanceof CachedBindingSet)) {
return false;
}
final CachedBindingSet other = (CachedBindingSet) object;
if (!Util.equals(activeContextTree, other.activeContextTree)) {
return false;
}
if (!Util.equals(locales, other.locales)) {
return false;
}
if (!Util.equals(platforms, other.platforms)) {
return false;
}
return Util.equals(schemeIds, other.schemeIds);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* <p>
* Tests whether the platform for the binding matches one of the active
* platforms.
* </p>
* <p>
* This method completes in <code>O(n)</code>, where <code>n</code> is
* the number of active platforms.
* </p>
*
* @param binding
* The binding with which to test; must not be <code>null</code>.
* @return <code>true</code> if the binding's platform matches;
* <code>false</code> otherwise.
*/
private final boolean platformMatches(final Binding binding) {
boolean matches = false;
final String platform = binding.getPlatform();
if (platform == null) {
return true; // shortcut a common case
}
for (int i = 0; i < platforms.length; i++) {
if (Util.equals(platforms[i], platform)) {
matches = true;
break;
}
}
return matches;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* <p>
* Tests whether the locale for the binding matches one of the active
* locales.
* </p>
* <p>
* This method completes in <code>O(n)</code>, where <code>n</code> is
* the number of active locales.
* </p>
*
* @param binding
* The binding with which to test; must not be <code>null</code>.
* @return <code>true</code> if the binding's locale matches;
* <code>false</code> otherwise.
*/
private final boolean localeMatches(final Binding binding) {
boolean matches = false;
final String locale = binding.getLocale();
if (locale == null) {
return true; // shortcut a common case
}
for (int i = 0; i < locales.length; i++) {
if (Util.equals(locales[i], locale)) {
matches = true;
break;
}
}
return matches;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* <p>
* Tests whether the platform for the binding matches one of the active
* platforms.
* </p>
* <p>
* This method completes in <code>O(n)</code>, where <code>n</code> is
* the number of active platforms.
* </p>
*
* @param binding
* The binding with which to test; must not be <code>null</code>.
* @return <code>true</code> if the binding's platform matches;
* <code>false</code> otherwise.
*/
private final boolean platformMatches(final Binding binding) {
boolean matches = false;
final String platform = binding.getPlatform();
if (platform == null) {
return true; // shortcut a common case
}
for (int i = 0; i < platforms.length; i++) {
if (Util.equals(platforms[i], platform)) {
matches = true;
break;
}
}
return matches;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* <p>
* Tests whether the locale for the binding matches one of the active
* locales.
* </p>
* <p>
* This method completes in <code>O(n)</code>, where <code>n</code> is
* the number of active locales.
* </p>
*
* @param binding
* The binding with which to test; must not be <code>null</code>.
* @return <code>true</code> if the binding's locale matches;
* <code>false</code> otherwise.
*/
private final boolean localeMatches(final Binding binding) {
boolean matches = false;
final String locale = binding.getLocale();
if (locale == null) {
return true; // shortcut a common case
}
for (int i = 0; i < locales.length; i++) {
if (Util.equals(locales[i], locale)) {
matches = true;
break;
}
}
return matches;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Computes whether the active bindings have changed for a given command
* identifier.
*
* @param parameterizedCommand
* The fully-parameterized command whose bindings might have
* changed; must not be <code>null</code>.
* @return <code>true</code> if the active bindings have changed for the
* given command identifier; <code>false</code> otherwise.
*/
public final boolean isActiveBindingsChangedFor(
final ParameterizedCommand parameterizedCommand) {
final TriggerSequence[] currentBindings = manager
.getActiveBindingsFor(parameterizedCommand);
final TriggerSequence[] previousBindings;
if (previousTriggersByParameterizedCommand != null) {
final Collection previousBindingCollection = (Collection) previousTriggersByParameterizedCommand
.get(parameterizedCommand);
if (previousBindingCollection == null) {
previousBindings = null;
} else {
previousBindings = (TriggerSequence[]) previousBindingCollection
.toArray(new TriggerSequence[previousBindingCollection
.size()]);
}
} else {
previousBindings = null;
}
return !Util.equals(currentBindings, previousBindings);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Set the internal working set fields specific to the navigator.
*
* @param workingSet
* the new working set
* @since 3.2
*/
private boolean internalSetWorkingSet(IWorkingSet workingSet) {
boolean refreshNeeded = !Util.equals(this.workingSet, workingSet);
this.workingSet = workingSet;
emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet()
&& workingSet.isEmpty();
return refreshNeeded;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Tests whether this binding is intended to delete another binding. The
* receiver must have a <code>null</code> command identifier.
*
* @param binding
* The binding to test; must not be <code>null</code>.
* This binding must be a <code>SYSTEM</code> binding.
* @return <code>true</code> if the receiver deletes the binding defined by
* the argument.
*/
final boolean deletes(final Binding binding) {
boolean deletes = true;
deletes &= Util.equals(getContextId(), binding.getContextId());
deletes &= Util.equals(getTriggerSequence(), binding
.getTriggerSequence());
if (getLocale() != null) {
deletes &= !Util.equals(getLocale(), binding.getLocale());
}
if (getPlatform() != null) {
deletes &= !Util.equals(getPlatform(), binding.getPlatform());
}
deletes &= (binding.getType() == SYSTEM);
deletes &= Util.equals(getParameterizedCommand(), null);
return deletes;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Tests whether this binding is intended to delete another binding. The
* receiver must have a <code>null</code> command identifier.
*
* @param binding
* The binding to test; must not be <code>null</code>.
* This binding must be a <code>SYSTEM</code> binding.
* @return <code>true</code> if the receiver deletes the binding defined by
* the argument.
*/
final boolean deletes(final Binding binding) {
boolean deletes = true;
deletes &= Util.equals(getContextId(), binding.getContextId());
deletes &= Util.equals(getTriggerSequence(), binding
.getTriggerSequence());
if (getLocale() != null) {
deletes &= !Util.equals(getLocale(), binding.getLocale());
}
if (getPlatform() != null) {
deletes &= !Util.equals(getPlatform(), binding.getPlatform());
}
deletes &= (binding.getType() == SYSTEM);
deletes &= Util.equals(getParameterizedCommand(), null);
return deletes;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
if (!Util.equals(this.platform, platform)) {
this.platform = platform;
this.platforms = expand(platform, Util.ZERO_LENGTH_STRING);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* <p>
* Changes the locale for this binding manager. The locale can be used to
* provide locale-specific bindings. If the locale is different than the
* current locale, this will force a recomputation of the bindings. The
* locale is in the same format as
* <code>Locale.getDefault().toString()</code>.
* </p>
* <p>
* This method completes in <code>O(1)</code>.
* </p>
*
* @param locale
* The new locale; must not be <code>null</code>.
* @see Locale#getDefault()
*/
public final void setLocale(final String locale) {
if (locale == null) {
throw new NullPointerException("The locale cannot be null"); //$NON-NLS-1$
}
if (!Util.equals(this.locale, locale)) {
this.locale = locale;
this.locales = expand(locale, LOCALE_SEPARATOR);
clearSolution();
fireBindingManagerChanged(new BindingManagerEvent(this, false,
null, false, null, false, true, false));
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
if (!Util.equals(this.platform, platform)) {
this.platform = platform;
this.platforms = expand(platform, Util.ZERO_LENGTH_STRING);
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* <p>
* Changes the locale for this binding manager. The locale can be used to
* provide locale-specific bindings. If the locale is different than the
* current locale, this will force a recomputation of the bindings. The
* locale is in the same format as
* <code>Locale.getDefault().toString()</code>.
* </p>
* <p>
* This method completes in <code>O(1)</code>.
* </p>
*
* @param locale
* The new locale; must not be <code>null</code>.
* @see Locale#getDefault()
*/
public final void setLocale(final String locale) {
if (locale == null) {
throw new NullPointerException("The locale cannot be null"); //$NON-NLS-1$
}
if (!Util.equals(this.locale, locale)) {
this.locale = locale;
this.locales = expand(locale, LOCALE_SEPARATOR);
clearSolution();
fireBindingManagerChanged(new BindingManagerEvent(this, false,
null, false, null, false, true, false));
}
}
内容来源于网络,如有侵权,请联系作者删除!