com.google.common.base.Objects Java Examples
The following examples show how to use
com.google.common.base.Objects.
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: DefaultLeaderElectorService.java From atomix with Apache License 2.0 | 6 votes |
@Override public boolean anoint(String topic, byte[] id) { try { Leadership<byte[]> oldLeadership = leadership(topic); ElectionState electionState = elections.computeIfPresent(topic, (k, v) -> v.transferLeadership(id, termCounter(topic))); Leadership<byte[]> newLeadership = leadership(topic); if (!Objects.equal(oldLeadership, newLeadership)) { notifyLeadershipChange(topic, oldLeadership, newLeadership); } return (electionState != null && electionState.leader() != null && Arrays.equals(id, electionState.leader().id())); } catch (Exception e) { getLogger().error("State machine operation failed", e); throwIfUnchecked(e); throw new RuntimeException(e); } }
Example #2
Source File: IAstAnnotatedTokenizer.java From api-mining with GNU General Public License v3.0 | 6 votes |
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AstAnnotatedToken other = (AstAnnotatedToken) obj; return Objects.equal(other.token, token) && Objects.equal(other.tokenAstNode, tokenAstNode) && Objects.equal(other.parentTokenAstNode, parentTokenAstNode); }
Example #3
Source File: ForcedRocketExchange.java From Rails with GNU General Public License v2.0 | 6 votes |
@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; // no asOption attributes if (asOption) return true; // check asAction attributes ForcedRocketExchange action = (ForcedRocketExchange)pa; return Objects.equal(this.companyToReceiveTrain, action.companyToReceiveTrain) && Objects.equal(this.trainToReplace, action.trainToReplace) ; }
Example #4
Source File: BaseAction.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") private List<Class<?>> listAssemble() throws Exception { if (null == assembles) { synchronized (BaseAction.class) { if (null == assembles) { try (ScanResult scanResult = new ClassGraph().enableAnnotationInfo().scan()) { assembles = new CopyOnWriteArrayList<Class<?>>(); List<ClassInfo> list = new ArrayList<>(); list.addAll(scanResult.getClassesWithAnnotation(Module.class.getName())); list = list.stream().sorted(Comparator.comparing(ClassInfo::getName)) .collect(Collectors.toList()); for (ClassInfo info : list) { Class<?> cls = Class.forName(info.getName()); Module module = cls.getAnnotation(Module.class); if (Objects.equal(module.type(), ModuleType.ASSEMBLE)) { assembles.add(cls); } } } } } } return assembles; }
Example #5
Source File: XbaseFormatter.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected XClosure builder(final List<XExpression> params) { XClosure _xifexpression = null; XExpression _last = IterableExtensions.<XExpression>last(params); boolean _tripleNotEquals = (_last != null); if (_tripleNotEquals) { XClosure _xblockexpression = null; { final EObject grammarElement = this.textRegionExtensions.grammarElement(IterableExtensions.<XExpression>last(params)); XClosure _xifexpression_1 = null; if (((Objects.equal(grammarElement, this.grammar.getXMemberFeatureCallAccess().getMemberCallArgumentsXClosureParserRuleCall_1_1_4_0()) || Objects.equal(grammarElement, this.grammar.getXFeatureCallAccess().getFeatureCallArgumentsXClosureParserRuleCall_4_0())) || Objects.equal(grammarElement, this.grammar.getXConstructorCallAccess().getArgumentsXClosureParserRuleCall_5_0()))) { XExpression _last_1 = IterableExtensions.<XExpression>last(params); _xifexpression_1 = ((XClosure) _last_1); } _xblockexpression = _xifexpression_1; } _xifexpression = _xblockexpression; } return _xifexpression; }
Example #6
Source File: ToasterNotifier.java From send-notification with MIT License | 5 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final ToasterNotifier other = (ToasterNotifier) obj; return Objects.equal(this.configuration, other.configuration); }
Example #7
Source File: Identity.java From supermonkey with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object o) { if(o instanceof With3 == false) { return false; } With2<T1, T2> another = (With2<T1, T2>) o; return Objects.equal(this.id1, another.id1) && Objects.equal(this.id2, another.id2); }
Example #8
Source File: String64.java From java-stellar-sdk with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object object) { if (object == null || !(object instanceof String64)) { return false; } String64 other = (String64) object; return Objects.equal(this.string64, other.string64); }
Example #9
Source File: Application.java From java-platform with Apache License 2.0 | 5 votes |
private void initExtension() { if (extensions != null) { List<ExtensionEntity> moduleEntities = extensionService.findAllExtension(); for (Extension module : extensions) { ExtensionEntity moduleEntity = findModuleEntityByCode(moduleEntities, module.getCode()); boolean isNew = moduleEntity == null; boolean isUpdate = isNew || !Objects.equal(module.getVersion(), moduleEntity.getVersion()); module.init(this, isNew, isUpdate, isNew ? null : moduleEntity.getVersion()); if (isNew) { moduleEntity = extensionService.newEntity(); moduleEntity.setCreatedBy(module.getAuthor()); moduleEntity.setCreatedDate(new Date()); moduleEntity.setType(Type.Extension); } if (isUpdate) { moduleEntity.setCode(module.getCode()); moduleEntity.setName(module.getName()); moduleEntity.setVersion(module.getVersion()); moduleEntity.setLastModifiedBy(module.getAuthor()); moduleEntity.setLastModifiedDate(new Date()); extensionService.save(moduleEntity); } } } }
Example #10
Source File: ProblemInfo.java From gerrit-rest-java-client with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object o) { if (!(o instanceof ProblemInfo)) { return false; } ProblemInfo p = (ProblemInfo) o; return Objects.equal(message, p.message) && Objects.equal(status, p.status) && Objects.equal(outcome, p.outcome); }
Example #11
Source File: UserName.java From james-project with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object o) { if (o instanceof UserName) { UserName that = (UserName) o; return Objects.equal(value, that.value); } return false; }
Example #12
Source File: DefaultPullRequestChangeManager.java From onedev with MIT License | 5 votes |
@Transactional @Override public void changeDescription(PullRequest request, @Nullable String description) { String prevDescription = request.getDescription(); if (!Objects.equal(prevDescription, description)) { request.setDescription(description); PullRequestChange change = new PullRequestChange(); change.setDate(new Date()); change.setRequest(request); change.setData(new PullRequestDescriptionChangeData(prevDescription, description)); change.setUser(SecurityUtils.getUser()); save(change); } }
Example #13
Source File: SearchQuery.java From james-project with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (obj instanceof NumericOperator) { NumericOperator that = (NumericOperator) obj; return Objects.equal(this.value, that.value) && Objects.equal(this.type, that.type); } return false; }
Example #14
Source File: AppConfiguration.java From joal with Apache License 2.0 | 5 votes |
@Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final AppConfiguration that = (AppConfiguration) o; return Objects.equal(minUploadRate, that.minUploadRate) && Objects.equal(maxUploadRate, that.maxUploadRate) && Objects.equal(simultaneousSeed, that.simultaneousSeed) && Objects.equal(client, that.client) && Objects.equal(keepTorrentWithZeroLeechers, that.keepTorrentWithZeroLeechers); }
Example #15
Source File: Block.java From cava with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Block)) { return false; } Block other = (Block) obj; return Objects.equal(header, other.header) && Objects.equal(body, other.body); }
Example #16
Source File: PermissionInfo.java From gerrit-rest-java-client with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (obj instanceof PermissionInfo) { PermissionInfo p = (PermissionInfo) obj; return Objects.equal(label, p.label) && Objects.equal(exclusive, p.exclusive) && Objects.equal(rules, p.rules); } return false; }
Example #17
Source File: MiltonResourceFactory.java From ganttproject with GNU General Public License v3.0 | 5 votes |
@Override public boolean equals(Object obj) { if (obj instanceof Key == false) { return false; } Key that = (Key) obj; return Objects.equal(this.url, that.url) && Objects.equal(this.username, that.username) && Objects.equal(this.password, that.password); }
Example #18
Source File: HashBiMap.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
private BiEntry<K, V> seekByKey(@Nullable Object key, int keyHash) { for (BiEntry<K, V> entry = hashTableKToV[keyHash & mask]; entry != null; entry = entry.nextInKToVBucket) { if (keyHash == entry.keyHash && Objects.equal(key, entry.key)) { return entry; } } return null; }
Example #19
Source File: StashRequest.java From emodb with Apache License 2.0 | 5 votes |
@Override public String toString() { return Objects.toStringHelper(getClass()) .add("requestedBy", _requestedBy) .add("requestTime", _requestTime) .toString(); }
Example #20
Source File: HiddenLeafAccess.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
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 #21
Source File: IndexStatsRecord.java From datawave with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object o) { if (!(o instanceof IndexStatsRecord)) { return false; } final IndexStatsRecord otherData = (IndexStatsRecord) o; return Objects.equal(numberUnique, otherData.numberUnique) && Objects.equal(count, otherData.count) && Objects.equal(averageWordLength, otherData.averageWordLength); }
Example #22
Source File: MutableJvmEnumerationTypeDeclarationImpl.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public MutableEnumerationValueDeclaration findDeclaredValue(final String name) { final Function1<MutableEnumerationValueDeclaration, Boolean> _function = (MutableEnumerationValueDeclaration value) -> { String _simpleName = value.getSimpleName(); return Boolean.valueOf(Objects.equal(_simpleName, name)); }; return IterableExtensions.findFirst(this.getDeclaredValues(), _function); }
Example #23
Source File: WindowSpecification.java From tablesaw with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WindowSpecification that = (WindowSpecification) o; return Objects.equal(windowName, that.windowName) && Objects.equal(partitionColumns, that.partitionColumns) && Objects.equal(sort, that.sort); }
Example #24
Source File: HandlerId.java From ldp4j with Apache License 2.0 | 5 votes |
@Override public int hashCode() { return Objects. hashCode( this.className,this.systemHashCode,this.container); }
Example #25
Source File: XmlStringOperationDecoderKey.java From arctic-sea with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (obj != null && getClass() == obj.getClass()) { final XmlStringOperationDecoderKey o = (XmlStringOperationDecoderKey) obj; return Objects.equal(getService(), o.getService()) && Objects.equal(getVersion(), o.getVersion()) && Objects.equal(getOperation(), o.getOperation()) && getContentType() != null && getContentType().isCompatible(o.getContentType()); } return false; }
Example #26
Source File: BlameCommit.java From onedev with MIT License | 5 votes |
@Override public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof BlameCommit)) return false; BlameCommit rhs = (BlameCommit) other; return Objects.equal(hash, rhs.hash); }
Example #27
Source File: ForwardingCollection.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
/** * A sensible definition of {@link #remove} in terms of {@link #iterator}, * using the iterator's {@code remove} method. If you override {@link * #iterator}, you may wish to override {@link #remove} to forward to this * implementation. * * @since 7.0 */ protected boolean standardRemove(@Nullable Object object) { Iterator<E> iterator = iterator(); while (iterator.hasNext()) { if (Objects.equal(iterator.next(), object)) { iterator.remove(); return true; } } return false; }
Example #28
Source File: AnswerKey.java From tac-kbp-eal with MIT License | 5 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final AnswerKey other = (AnswerKey) obj; return Objects.equal(this.docid, other.docid) && Objects .equal(this.annotatedArgs, other.annotatedArgs) && Objects .equal(this.unannotatedResponses, other.unannotatedResponses) && Objects .equal(this.corefAnnotation, other.corefAnnotation); }
Example #29
Source File: JPAMailboxAnnotation.java From james-project with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object o) { if (o instanceof JPAMailboxAnnotation) { JPAMailboxAnnotation that = (JPAMailboxAnnotation) o; return Objects.equal(this.mailboxId, that.mailboxId) && Objects.equal(this.key, that.key) && Objects.equal(this.value, that.value); } return false; }
Example #30
Source File: ModelEntity.java From arcusplatform with Apache License 2.0 | 5 votes |
@Override public Object setAttribute(String name, Object value) { Object old = super.setAttribute(name, value); // don't allow multiple writes to overwrite the original value if(oldAttributes.containsKey(name)) { if(Objects.equal(oldAttributes.get(name), value)) { // re-set to the original, not actually dirty oldAttributes.remove(name); } } else if(!Objects.equal(old, value)) { oldAttributes.put(name, old); } return old; }