コード例 #1
1
 @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;
 }
コード例 #2
1
  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);
    }
  }
コード例 #3
1
 public boolean equals(Object other) {
   if (other instanceof TypeToNameMap) {
     TypeToNameMap otherMap = (TypeToNameMap) other;
     return myPatterns.equals(otherMap.myPatterns) && myNames.equals(otherMap.myNames);
   }
   return false;
 }
コード例 #4
1
  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.");
  }
コード例 #5
1
  @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;
  }
コード例 #6
1
  @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;
  }
コード例 #7
0
    @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;
    }
コード例 #8
0
  @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;
  }
コード例 #9
0
ファイル: POSTaggerTester.java プロジェクト: QimingChen/NLP
    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;
    }
コード例 #10
0
ファイル: JavaDatasetSuite.java プロジェクト: pallavipr/spark
    @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);
    }
コード例 #11
0
 /**
  * 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);
   }
 }
コード例 #12
0
ファイル: TestV3LcapMessage.java プロジェクト: ravn/lockss
  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.

  }
コード例 #13
0
  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;
  }
コード例 #14
0
 public boolean equals(Object o) {
   if (o instanceof NAry) {
     NAry n = (NAry) o;
     return patterns.equals(n.patterns);
   }
   return false;
 }
コード例 #15
0
ファイル: Track.java プロジェクト: Kmandr/jahspotify
  @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;
  }
コード例 #16
0
  @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;
  }
コード例 #17
0
ファイル: Lexicon.java プロジェクト: kevinkissi/openccg
 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);
 }
コード例 #18
0
ファイル: PdfArray.java プロジェクト: adamrduffy/pjx
  public boolean equals(Object obj) {

    if ((obj == null) || (!(obj instanceof PdfArray))) {
      return false;
    }

    return _a.equals(((PdfArray) obj)._a);
  }
コード例 #19
0
ファイル: Forest.java プロジェクト: skallumadi/policyLearner
 @Override
 public boolean equals(Object o) {
   Forest other = (Forest) o;
   if (size != other.size) {
     return false;
   }
   return roots.equals(other.roots);
 }
コード例 #20
0
  @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);
  }
コード例 #21
0
ファイル: View.java プロジェクト: vasilev/JGroups
 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);
 }
コード例 #22
0
 /**
  * {@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();
   }
 }
コード例 #23
0
 @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;
 }
コード例 #24
0
 @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;
 }
コード例 #25
0
ファイル: OutputVerifier.java プロジェクト: ktw14/vitoex
 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());
   }
 }
コード例 #26
0
 /**
  * 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;
 }
コード例 #27
0
  // 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;
  }
コード例 #28
0
  @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));
  }
コード例 #29
0
  @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;
  }
コード例 #30
0
  /** 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));
  }