Java Code Examples for com.google.common.base.Objects#equal()

The following examples show how to use com.google.common.base.Objects#equal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected JvmOperation findOperation(final String name, final boolean mustBeArray) {
  final JvmOperation result = this.findOperation(name);
  JvmTypeReference _returnType = result.getReturnType();
  JvmType _type = null;
  if (_returnType!=null) {
    _type=_returnType.getType();
  }
  final JvmType returnType = _type;
  boolean _and = false;
  if (!mustBeArray) {
    _and = false;
  } else {
    EClass _eClass = null;
    if (returnType!=null) {
      _eClass=returnType.eClass();
    }
    boolean _notEquals = (!Objects.equal(_eClass, TypesPackage.Literals.JVM_ARRAY_TYPE));
    _and = _notEquals;
  }
  if (_and) {
    throw new IllegalArgumentException("Cannot assign array value to simple annotation property");
  }
  return result;
}
 
Example 2
Source File: GetSplitsRequest.java    From aws-athena-query-federation with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(Object o)
{
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    GetSplitsRequest that = (GetSplitsRequest) o;

    Objects.equal(this.tableName, that.tableName);
    Objects.equal(this.partitions, that.partitions);
    CollectionsUtils.equals(this.partitionCols, that.partitionCols);
    Objects.equal(this.continuationToken, that.continuationToken);
    Objects.equal(this.getRequestType(), that.getRequestType());
    Objects.equal(this.getCatalogName(), that.getCatalogName());

    return Objects.equal(this.tableName, that.tableName) &&
            Objects.equal(this.partitions, that.partitions) &&
            CollectionsUtils.equals(this.partitionCols, that.partitionCols) &&
            Objects.equal(this.continuationToken, that.continuationToken) &&
            Objects.equal(this.getRequestType(), that.getRequestType()) &&
            Objects.equal(this.getCatalogName(), that.getCatalogName());
}
 
Example 3
Source File: AspectValueKey.java    From bazel with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(Object other) {
  if (this == other) {
    return true;
  }

  if (!(other instanceof AspectKey)) {
    return false;
  }

  AspectKey that = (AspectKey) other;
  return Objects.equal(baseKeys, that.baseKeys)
      && Objects.equal(aspectConfigurationKey, that.aspectConfigurationKey)
      && Objects.equal(baseConfiguredTargetKey, that.baseConfiguredTargetKey)
      && Objects.equal(aspectDescriptor, that.aspectDescriptor);
}
 
Example 4
Source File: Capability.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(final Object other) {
  // use class identity since we don't allow capability inheritance beyond this to its direct children.
  if (!(other.getClass().equals(this.getClass()))) {
    return false;
  }
  Capability<?> castOther = (Capability<?>) other;
  return Objects.equal(name, castOther.name) && Objects.equal(defaultValue, castOther.defaultValue)
      && Objects.equal(usedInExecution, castOther.usedInExecution);
}
 
Example 5
Source File: TeNodeEventSubject.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object object) {
    if (this == object) {
        return true;
    }
    if (object instanceof TeNodeEventSubject) {
        TeNodeEventSubject that = (TeNodeEventSubject) object;
        return Objects.equal(key, that.key) &&
                Objects.equal(teNode, that.teNode);
    }
    return false;
}
 
Example 6
Source File: HiddenLeafAccess.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected List<ILeafNode> findPreviousHiddenLeafs(final INode node) {
  List<ILeafNode> _xblockexpression = null;
  {
    INode current = node;
    while ((current instanceof ICompositeNode)) {
      current = ((ICompositeNode)current).getLastChild();
    }
    final ArrayList<ILeafNode> result = CollectionLiterals.<ILeafNode>newArrayList();
    if ((current != null)) {
      final NodeIterator ni = new NodeIterator(current);
      while (ni.hasPrevious()) {
        {
          final INode previous = ni.previous();
          if (((!Objects.equal(previous, current)) && (previous instanceof ILeafNode))) {
            boolean _isHidden = ((ILeafNode) previous).isHidden();
            if (_isHidden) {
              result.add(((ILeafNode) previous));
            } else {
              return ListExtensions.<ILeafNode>reverse(result);
            }
          }
        }
      }
    }
    _xblockexpression = ListExtensions.<ILeafNode>reverse(result);
  }
  return _xblockexpression;
}
 
Example 7
Source File: SwiftKeystone2ObjectStorage.java    From james-project with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (o instanceof Configuration) {
        Configuration that = (Configuration) o;
        return Objects.equal(endpoint, that.endpoint) &&
            Objects.equal(identity, that.identity) &&
            Objects.equal(region, that.region) &&
            Objects.equal(credentials, that.credentials);
    }
    return false;
}
 
Example 8
Source File: ForwardingMap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * A sensible, albeit inefficient, definition of {@link #remove} in terms of
 * the {@code iterator} method of {@link #entrySet}. If you override {@link
 * #entrySet}, you may wish to override {@link #remove} to forward to this
 * implementation.
 *
 * <p>Alternately, you may wish to override {@link #remove} with {@code
 * keySet().remove}, assuming that approach would not lead to an infinite
 * loop.
 *
 * @since 7.0
 */

@Beta
protected V standardRemove(@Nullable Object key) {
  Iterator<Entry<K, V>> entryIterator = entrySet().iterator();
  while (entryIterator.hasNext()) {
    Entry<K, V> entry = entryIterator.next();
    if (Objects.equal(entry.getKey(), key)) {
      V value = entry.getValue();
      entryIterator.remove();
      return value;
    }
  }
  return null;
}
 
Example 9
Source File: ExchangeTokens.java    From Rails with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected boolean equalsAs(PossibleAction pa, boolean asOption) {
    // identity always true
    if (pa == this) return true;
    //  super checks both class identity and super class attributes
    if (!super.equalsAs(pa, asOption)) return false;

    // check asOption attributes
    ExchangeTokens action = (ExchangeTokens)pa;
    return Objects.equal(this.tokensToExchange, action.tokensToExchange)
            && Objects.equal(this.minNumberToExchange, action.minNumberToExchange)
            && Objects.equal(this.maxNumberToExchange, action.maxNumberToExchange)
    ;
    // no asAction attributes to be checked
}
 
Example 10
Source File: DeepEqualsTesterTest.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  IncorrectEqualsAndHash foo = (IncorrectEqualsAndHash) o;
  return Objects.equal(name, foo.name);
}
 
Example 11
Source File: EdsLoadBalancerProvider.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
  if (!(obj instanceof EdsConfig)) {
    return false;
  }
  EdsConfig that = (EdsConfig) obj;
  return Objects.equal(this.clusterName, that.clusterName)
      && Objects.equal(this.edsServiceName, that.edsServiceName)
      && Objects.equal(this.lrsServerName, that.lrsServerName)
      && Objects.equal(this.endpointPickingPolicy, that.endpointPickingPolicy);
}
 
Example 12
Source File: ColumnMapping.java    From kite with Apache License 2.0 5 votes vote down vote up
@Override
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
    value="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION",
    justification="Default annotation is not correct for equals")
public boolean equals(@Nullable Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  ColumnMapping that = (ColumnMapping) o;
  return Objects.equal(fieldMappings, that.fieldMappings);
}
 
Example 13
Source File: ReportQuery.java    From googleads-java-lib with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
  if (obj instanceof ReportQuery) {
    ReportQuery other = (ReportQuery) obj;
    return Objects.equal(this.awqlQuery, other.awqlQuery);
  }
  return false;
}
 
Example 14
Source File: CreateGroupRequest.java    From keywhiz with Apache License 2.0 5 votes vote down vote up
@Override public boolean equals(Object o) {
  if (this == o) return true;
  if (o instanceof CreateGroupRequest) {
    CreateGroupRequest that = (CreateGroupRequest) o;
    if (Objects.equal(this.name, that.name) &&
        Objects.equal(this.description, that.description) &&
        Objects.equal(this.metadata, that.metadata)) {
      return true;
    }
  }
  return false;
}
 
Example 15
Source File: SelectionModel.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override   
public boolean add( Integer selection ) {        
    if( mode == SelectionMode.Single ) {
        if( Objects.equal(selection, lastAdd) && size() == 1 )
            return false; 
        clear();
    }
    lastAdd = selection;
    return super.add(selection);
}
 
Example 16
Source File: Multisets.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Indicates whether an object equals this entry, following the behavior
 * specified in {@link Multiset.Entry#equals}.
 */
@Override
public boolean equals(@Nullable Object object) {
  if (object instanceof Multiset.Entry) {
    Multiset.Entry<?> that = (Multiset.Entry<?>) object;
    return this.getCount() == that.getCount()
        && Objects.equal(this.getElement(), that.getElement());
  }
  return false;
}
 
Example 17
Source File: HashBiMap.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private V put(@Nullable K key, @Nullable V value, boolean force) {
  int keyHash = smearedHash(key);
  int valueHash = smearedHash(value);
  BiEntry<K, V> oldEntryForKey = seekByKey(key, keyHash);
  if (oldEntryForKey != null && valueHash == oldEntryForKey.valueHash
      && Objects.equal(value, oldEntryForKey.value)) {
    return value;
  }
  BiEntry<K, V> oldEntryForValue = seekByValue(value, valueHash);
  if (oldEntryForValue != null) {
    if (force) {
      delete(oldEntryForValue);
    } else {
      throw new IllegalArgumentException("value already present: " + value);
    }
  }
  BiEntry<K, V> newEntry = new BiEntry<K, V>(key, keyHash, value, valueHash);
  if (oldEntryForKey != null) {
    delete(oldEntryForKey);
    insert(newEntry, oldEntryForKey);
    oldEntryForKey.prevInKeyInsertionOrder = null;
    oldEntryForKey.nextInKeyInsertionOrder = null;
    rehashIfNecessary();
    return oldEntryForKey.value;
  } else {
    insert(newEntry, null);
    rehashIfNecessary();
    return null;
  }
}
 
Example 18
Source File: CommonNodeData.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object object) {
    if (this == object) {
        return true;
    }
    if (object instanceof CommonNodeData) {
        CommonNodeData that = (CommonNodeData) object;
        return Objects.equal(name, that.name) &&
                Objects.equal(adminStatus, that.adminStatus) &&
                Objects.equal(opStatus, that.opStatus) &&
                Objects.equal(flags, that.flags);
    }
    return false;
}
 
Example 19
Source File: ValidateableAttestation.java    From teku with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (!(o instanceof ValidateableAttestation)) return false;
  ValidateableAttestation that = (ValidateableAttestation) o;
  return Objects.equal(getAttestation(), that.getAttestation())
      && Objects.equal(maybeAggregate, that.maybeAggregate);
}
 
Example 20
Source File: Providers.java    From businessworks with Apache License 2.0 4 votes vote down vote up
@Override public boolean equals(Object obj) {
  return (obj instanceof ConstantProvider)
      && Objects.equal(instance, ((ConstantProvider<?>) obj).instance);
}