@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; EducationJSONImpl other = (EducationJSONImpl) obj; if (classes == null) { if (other.classes != null) return false; } else if (!classes.equals(other.classes)) return false; if (concentration == null) { if (other.concentration != null) return false; } else if (!concentration.equals(other.concentration)) return false; if (degree == null) { if (other.degree != null) return false; } else if (!degree.equals(other.degree)) return false; if (school == null) { if (other.school != null) return false; } else if (!school.equals(other.school)) return false; if (type == null) { if (other.type != null) return false; } else if (!type.equals(other.type)) return false; if (with == null) { if (other.with != null) return false; } else if (!with.equals(other.with)) return false; if (year == null) { if (other.year != null) return false; } else if (!year.equals(other.year)) return false; return true; }
private synchronized void setWatchRoots( List<String> recursive, List<String> flat, boolean restart) { if (myProcessHandler == null || myProcessHandler.isProcessTerminated()) return; if (ApplicationManager.getApplication().isDisposeInProgress()) { recursive = flat = Collections.emptyList(); } if (!restart && myRecursiveWatchRoots.equals(recursive) && myFlatWatchRoots.equals(flat)) { return; } mySettingRoots.incrementAndGet(); myMapping = emptyList(); myRecursiveWatchRoots = recursive; myFlatWatchRoots = flat; try { writeLine(ROOTS_COMMAND); for (String path : recursive) { writeLine(path); } for (String path : flat) { writeLine("|" + path); } writeLine("#"); } catch (IOException e) { LOG.warn(e); } }
public boolean equals(Object other) { if (other instanceof TypeToNameMap) { TypeToNameMap otherMap = (TypeToNameMap) other; return myPatterns.equals(otherMap.myPatterns) && myNames.equals(otherMap.myNames); } return false; }
public static void main(String[] args) { int n = 10000; if (args.length > 0) n = Integer.parseInt(args[0]); List<Integer> sorted = new ArrayList<Integer>(n); for (int i = 0; i < n; i++) sorted.add(new Integer(i)); List<Integer> shuffled = new ArrayList<Integer>(sorted); Collections.shuffle(shuffled); Queue<Integer> pq = new PriorityQueue<Integer>(n, new MyComparator()); for (Iterator<Integer> i = shuffled.iterator(); i.hasNext(); ) pq.add(i.next()); List<Integer> recons = new ArrayList<Integer>(); while (!pq.isEmpty()) recons.add(pq.remove()); if (!recons.equals(sorted)) throw new RuntimeException("Sort test failed"); recons.clear(); pq = new PriorityQueue<Integer>(shuffled); while (!pq.isEmpty()) recons.add(pq.remove()); if (!recons.equals(sorted)) throw new RuntimeException("Sort test failed"); // Remove all odd elements from queue pq = new PriorityQueue<Integer>(shuffled); for (Iterator<Integer> i = pq.iterator(); i.hasNext(); ) if ((i.next().intValue() & 1) == 1) i.remove(); recons.clear(); while (!pq.isEmpty()) recons.add(pq.remove()); for (Iterator<Integer> i = sorted.iterator(); i.hasNext(); ) if ((i.next().intValue() & 1) == 1) i.remove(); if (!recons.equals(sorted)) throw new RuntimeException("Iterator remove test failed."); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HgRepoInfo info = (HgRepoInfo) o; if (myState != info.myState) return false; if (myTipRevision != null ? !myTipRevision.equals(info.myTipRevision) : info.myTipRevision != null) return false; if (myCurrentRevision != null ? !myCurrentRevision.equals(info.myCurrentRevision) : info.myCurrentRevision != null) return false; if (!myCurrentBranch.equals(info.myCurrentBranch)) return false; if (myCurrentBookmark != null ? !myCurrentBookmark.equals(info.myCurrentBookmark) : info.myCurrentBookmark != null) return false; if (!myBranches.equals(info.myBranches)) return false; if (!myBookmarks.equals(info.myBookmarks)) return false; if (!myTags.equals(info.myTags)) return false; if (!myLocalTags.equals(info.myLocalTags)) return false; if (!mySubrepos.equals(info.mySubrepos)) return false; if (!myMQApplied.equals(info.myMQApplied)) return false; if (!myMqNames.equals(info.myMqNames)) return false; return true; }
@Nullable public static PyType getType(@NotNull PsiElement resolved, @NotNull List<PyType> elementTypes) { final String qualifiedName = getQualifiedName(resolved); final List<Integer> paramListTypePositions = new ArrayList<>(); final List<Integer> ellipsisTypePositions = new ArrayList<>(); for (int i = 0; i < elementTypes.size(); i++) { final PyType type = elementTypes.get(i); if (type instanceof PyTypeParser.ParameterListType) { paramListTypePositions.add(i); } else if (type instanceof PyTypeParser.EllipsisType) { ellipsisTypePositions.add(i); } } if (!paramListTypePositions.isEmpty()) { if (!("typing.Callable".equals(qualifiedName) && paramListTypePositions.equals(list(0)))) { return null; } } if (!ellipsisTypePositions.isEmpty()) { if (!("typing.Callable".equals(qualifiedName) && ellipsisTypePositions.equals(list(0)) || "typing.Tuple".equals(qualifiedName) && ellipsisTypePositions.equals(list(1)) && elementTypes.size() == 2)) { return null; } } if ("typing.Union".equals(qualifiedName)) { return PyUnionType.union(elementTypes); } if ("typing.Optional".equals(qualifiedName) && elementTypes.size() == 1) { return PyUnionType.union(elementTypes.get(0), PyNoneType.INSTANCE); } if ("typing.Callable".equals(qualifiedName) && elementTypes.size() == 2) { final PyTypeParser.ParameterListType paramList = as(elementTypes.get(0), PyTypeParser.ParameterListType.class); if (paramList != null) { return new PyCallableTypeImpl(paramList.getCallableParameters(), elementTypes.get(1)); } if (elementTypes.get(0) instanceof PyTypeParser.EllipsisType) { return new PyCallableTypeImpl(null, elementTypes.get(1)); } } if ("typing.Tuple".equals(qualifiedName)) { if (elementTypes.size() > 1 && elementTypes.get(1) instanceof PyTypeParser.EllipsisType) { return PyTupleType.createHomogeneous(resolved, elementTypes.get(0)); } return PyTupleType.create(resolved, elementTypes); } final PyType builtinCollection = getBuiltinCollection(resolved); if (builtinCollection instanceof PyClassType) { final PyClassType classType = (PyClassType) builtinCollection; return new PyCollectionTypeImpl(classType.getPyClass(), false, elementTypes); } return null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TypeParameterValues)) return false; TypeParameterValues that = (TypeParameterValues) o; if (!names.equals(that.names)) return false; if (!usages.equals(that.usages)) return false; return true; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AggregationQuery query = (AggregationQuery) o; if (!keys.equals(query.keys)) return false; if (!measures.equals(query.measures)) return false; if (!predicate.equals(query.predicate)) return false; return true; }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TaggedSentence)) return false; final TaggedSentence taggedSentence = (TaggedSentence) o; if (tags != null ? !tags.equals(taggedSentence.tags) : taggedSentence.tags != null) return false; if (words != null ? !words.equals(taggedSentence.words) : taggedSentence.words != null) return false; return true; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SimpleJavaBean that = (SimpleJavaBean) o; if (a != that.a) return false; if (b != that.b) return false; if (!Arrays.equals(c, that.c)) return false; if (!Arrays.equals(d, that.d)) return false; if (!e.equals(that.e)) return false; return f.equals(that.f); }
/** * Sorts our values by {@code comparator} (and continually applies the comparator as new values * are added/removed/set). */ public void setComparator(Comparator<E> comparator) { this.persistentComparator = comparator; List<E> copy = copyLastValue(getDirect()); if (copy != null && !copy.equals(getDirect())) { set(copy); } }
private void assertEqualMessages(V3LcapMessage a, V3LcapMessage b) throws Exception { assertTrue(a.getOriginatorId() == b.getOriginatorId()); assertEquals(a.getOpcode(), b.getOpcode()); assertEquals(a.getTargetUrl(), b.getTargetUrl()); assertEquals(a.getArchivalId(), b.getArchivalId()); assertEquals(a.getProtocolVersion(), b.getProtocolVersion()); assertEquals(a.getPollerNonce(), b.getPollerNonce()); assertEquals(a.getVoterNonce(), b.getVoterNonce()); assertEquals(a.getVoterNonce2(), b.getVoterNonce2()); assertEquals(a.getPluginVersion(), b.getPluginVersion()); assertEquals(a.getHashAlgorithm(), b.getHashAlgorithm()); assertEquals(a.isVoteComplete(), b.isVoteComplete()); assertEquals(a.getRepairDataLength(), b.getRepairDataLength()); assertEquals(a.getLastVoteBlockURL(), b.getLastVoteBlockURL()); assertIsomorphic(a.getNominees(), b.getNominees()); List aBlocks = new ArrayList(); List bBlocks = new ArrayList(); for (VoteBlocksIterator iter = a.getVoteBlockIterator(); iter.hasNext(); ) { aBlocks.add(iter.next()); } for (VoteBlocksIterator iter = b.getVoteBlockIterator(); iter.hasNext(); ) { bBlocks.add(iter.next()); } assertTrue(aBlocks.equals(bBlocks)); // TODO: Figure out how to test time. }
private RelationalNode correctProjectionInternalTables(PlanNode node, AccessNode aNode) throws QueryMetadataException, TeiidComponentException { if (node.getGroups().size() != 1) { return aNode; } GroupSymbol group = node.getGroups().iterator().next(); if (!CoreConstants.SYSTEM_MODEL.equals( metadata.getFullName(metadata.getModelID(group.getMetadataID()))) && !CoreConstants.SYSTEM_ADMIN_MODEL.equals( metadata.getFullName(metadata.getModelID(group.getMetadataID())))) { return aNode; } List projectSymbols = (List) node.getProperty(NodeConstants.Info.OUTPUT_COLS); List<ElementSymbol> acutalColumns = ResolverUtil.resolveElementsInGroup(group, metadata); if (projectSymbols.equals(acutalColumns)) { return aNode; } node.setProperty(NodeConstants.Info.OUTPUT_COLS, acutalColumns); if (node.getParent() != null && node.getParent().getType() == NodeConstants.Types.PROJECT) { // if the parent is already a project, just correcting the output cols is enough return aNode; } ProjectNode pnode = new ProjectNode(getID()); pnode.setSelectSymbols(projectSymbols); aNode = (AccessNode) prepareToAdd(node, aNode); node.setProperty(NodeConstants.Info.OUTPUT_COLS, projectSymbols); pnode.addChild(aNode); return pnode; }
public boolean equals(Object o) { if (o instanceof NAry) { NAry n = (NAry) o; return patterns.equals(n.patterns); } return false; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof Track)) { return false; } final Track track = (Track) o; if (explicit != track.explicit) { return false; } if (length != track.length) { return false; } if (trackNumber != track.trackNumber) { return false; } if (album != null ? !album.equals(track.album) : track.album != null) { return false; } if (artists != null ? !artists.equals(track.artists) : track.artists != null) { return false; } if (cover != null ? !cover.equals(track.cover) : track.cover != null) { return false; } if (title != null ? !title.equals(track.title) : track.title != null) { return false; } return true; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DocumentFoldingInfo info = (DocumentFoldingInfo) o; if (myFile != null ? !myFile.equals(info.myFile) : info.myFile != null) { return false; } if (!myProject.equals(info.myProject) || !myPsiElements.equals(info.myPsiElements) || !mySerializedElements.equals(info.mySerializedElements)) { return false; } if (myRangeMarkers.size() != info.myRangeMarkers.size()) return false; for (int i = 0; i < myRangeMarkers.size(); i++) { RangeMarker marker = myRangeMarkers.get(i); RangeMarker other = info.myRangeMarkers.get(i); if (marker == other || !marker.isValid() || !other.isValid()) { continue; } if (!TextRange.areSegmentsEqual(marker, other)) return false; FoldingInfo fi = marker.getUserData(FOLDING_INFO_KEY); FoldingInfo ofi = other.getUserData(FOLDING_INFO_KEY); if (!Comparing.equal(fi, ofi)) return false; } return true; }
public boolean equals(Object obj) { if (!(obj instanceof PredLookup)) return false; PredLookup pLook = (PredLookup) obj; if (!pred.equals(pLook.pred)) return false; if (coartRels == null) return (pLook.coartRels == null); return coartRels.equals(pLook.coartRels); }
public boolean equals(Object obj) { if ((obj == null) || (!(obj instanceof PdfArray))) { return false; } return _a.equals(((PdfArray) obj)._a); }
@Override public boolean equals(Object o) { Forest other = (Forest) o; if (size != other.size) { return false; } return roots.equals(other.roots); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GridEnsembleCoord that = (GridEnsembleCoord) o; return ensCoords.equals(that.ensCoords); }
public boolean equals(Object obj) { if (!(obj instanceof View)) return false; int rc = vid.compareTo(((View) obj).vid); return rc == 0 && members != null && ((View) obj).members != null && members.equals(((View) obj).members); }
/** * {@collect.stats} Changes the list that defines this sequence and resets the index of the models * <code>value</code> to zero. Note that <code>list</code> is not copied, the model just stores a * reference to it. * * <p>This method fires a <code>ChangeEvent</code> if <code>list</code> is not equal to the * current list. * * @param list the sequence that this model represents * @throws IllegalArgumentException if <code>list</code> is <code>null</code> or zero length * @see #getList */ public void setList(List<?> list) { if ((list == null) || (list.size() == 0)) { throw new IllegalArgumentException("invalid list"); } if (!list.equals(this.list)) { this.list = list; index = 0; fireStateChanged(); } }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DefaultInitialisers)) { return false; } final DefaultInitialisers other = (DefaultInitialisers) obj; if (!constructors.equals(other.constructors)) { return false; } if (!methods.equals(other.methods)) { return false; } return true; }
@SuppressWarnings("rawtypes") @Override public boolean equals(Object obj) { if (super.equals(obj)) { ListTag o = (ListTag) obj; if (type == o.type) { return list.equals(o.list); } } return false; }
public static void verify(List output, List expected) { verifyLength(output.size(), expected.size(), Test.EXACT); if (!expected.equals(output)) { // find the line of mismatch ListIterator it1 = expected.listIterator(); ListIterator it2 = output.listIterator(); while (it1.hasNext() && it2.hasNext() && it1.next().equals(it2.next())) ; throw new LineMismatchException( it1.nextIndex(), it1.previous().toString(), it2.previous().toString()); } }
/** * Compares 2 JSONObjects for equality. Ignores property order and only matches on defined * properties and property values. * * @param jsonObject1 * @param jsonObject2 * @return */ public static boolean isEqual(final JSONObject jsonObject1, final JSONObject jsonObject2) { if (jsonObject1 == null || JSONObject.getNames(jsonObject1) == null) { // if object 1 is null or empty -> object 2 should also be null or empty return (jsonObject2 == null || JSONObject.getNames(jsonObject2) == null); } else if (jsonObject2 == null || JSONObject.getNames(jsonObject2) == null) { return false; } final List<String> objectProperties1 = Arrays.asList(JSONObject.getNames(jsonObject1)); Collections.sort(objectProperties1); final List<String> objectProperties2 = Arrays.asList(JSONObject.getNames(jsonObject2)); Collections.sort(objectProperties2); // compare sorted propertynames if (!objectProperties1.equals(objectProperties2)) { log.debug( "Object:\n", objectProperties1, "didn't have same properties as:\n", objectProperties2); return false; } try { for (String key : objectProperties1) { final Object value1 = jsonObject1.get(key); final Object value2 = jsonObject2.get(key); if (value1 instanceof JSONObject) { if (!(value2 instanceof JSONObject)) { log.debug(value1, "was a JSONObject unlike", value2); return false; } else if (!isEqual((JSONObject) value1, (JSONObject) value2)) { log.debug("JSONObject recursion was not equal"); return false; } } else if (value1 instanceof JSONArray) { if (!(value2 instanceof JSONArray)) { log.debug(value1, "was a JSONArray unlike", value2); return false; } if (!isEqual((JSONArray) value1, (JSONArray) value2)) { log.debug("JSONArrays were not equal"); return false; } } else if (value1 == null) { if (value2 != null) { log.debug("value1 was <null>, but value2 was:" + value2); return false; } } else if (!value1.equals(value2)) { log.debug("Values were not equal:", value1, "!=", value2); return false; } } } catch (Exception ex) { log.warn(ex, "Error comparing JSONObjects"); return false; } return true; }
// Done inefficiently so as to exercise toArray static List clone(List s) { List a = Arrays.asList(s.toArray()); if (s.hashCode() != a.hashCode()) fail("Incorrect hashCode computation."); List clone = newList(); clone.addAll(a); if (!s.equals(clone)) fail("List not equal to copy."); if (!s.containsAll(clone)) fail("List does not contain copy."); if (!clone.containsAll(s)) fail("Copy does not contain list."); return clone; }
@Test public void testListEquals() { List<String> s = new ArrayList<String>(); s.add("GMethod"); s.add("ClassCast"); s.add("RawType"); List<String> r = new InstrumentedList<String>(s); List<String> q = new InstrumentedList<String>(r); assertTrue(r.equals(q)); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TurinTypeDefinition that = (TurinTypeDefinition) o; if (!members.equals(that.members)) return false; if (!name.equals(that.name)) return false; return true; }
/** Test that before the timeout we have a draw that is not 1, 2, ..., MAX */ @Test(timeout = 1000L) public void testDrawIsRandom() throws Exception { final List<Integer> nonRandom = new ArrayList<>(); for (int i = 1; i < SilanisLottery.MAX_BALL; i++) { nonRandom.add(i); } List<Integer> draws; do { draws = new ArrayList<>(); this.fillDraws(draws); } while (draws.equals(nonRandom)); }