Exemplo n.º 1
0
 @Override
 public boolean equals(Object object) {
   if (!(object instanceof ContentValues)) {
     return false;
   }
   return mValues.equals(((ContentValues) object).mValues);
 }
Exemplo n.º 2
0
  /**
   * This operation is used to check equality between this Polygon and another Polygon. It returns
   * true if the Polygons are equal and false if they are not.
   *
   * @param otherObject
   *     <p>The other Object that should be compared with this one.
   * @return
   *     <p>True if the Objects are equal, false otherwise.
   */
  @Override
  public boolean equals(Object otherObject) {

    // By default, the objects are not equivalent.
    boolean equals = false;

    // Check the reference.
    if (this == otherObject) {
      equals = true;
    }
    // Check the information stored in the other object.
    else if (otherObject != null && otherObject instanceof Polygon) {

      // We can now cast the other object.
      Polygon polygon = (Polygon) otherObject;

      // Compare the values between the two objects.
      equals =
          (super.equals(otherObject)
              && vertices.equals(polygon.vertices)
              && edges.equals(polygon.edges)
              && edgeProperties.equals(polygon.edgeProperties)
              && polygonProperties.equals(polygon.polygonProperties));
    }

    return equals;
  }
 /* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof StringConcatServiceGroup) {
     StringConcatServiceGroup otherGroup = (StringConcatServiceGroup) obj;
     if (service.equals(otherGroup.service)
         && triples.equals(otherGroup.triples)
         && filters.equals(otherGroup.filters)
         && subjectRules.equals(otherGroup.subjectRules)
         && predicateRules.equals(otherGroup.predicateRules)
         && objectRules.equals(otherGroup.objectRules)
         && scTriples.equals(otherGroup.scTriples)
         && concat.equals(otherGroup.concat)
         && tripleInHead.equals(otherGroup.tripleInHead)
         && variablesOrderedByRule.equals(otherGroup.variablesOrderedByRule)) return true;
   }
   return false;
 }
Exemplo n.º 4
0
  // Javadoc inherited.
  public boolean equals(Object obj) {
    if (!(obj instanceof StructureValue)) {
      return false;
    }

    StructureValue other = (StructureValue) obj;

    return fieldValues.equals(other.getFieldValuesAsMap());
  }
Exemplo n.º 5
0
 /** @see java.lang.Object#equals(java.lang.Object) */
 @SuppressWarnings("unchecked")
 public boolean equals(Object msg) {
   if (msg == null) return false;
   COSTmsg<Val, U> msgCast = (COSTmsg<Val, U>) msg;
   return sender.equals(msgCast.sender)
       && receiver.equals(msgCast.receiver)
       && context.equals(msgCast.context)
       && lb.equals(msgCast.lb)
       && ub.equals(msgCast.ub);
 }
Exemplo n.º 6
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   MappedMapD other = (MappedMapD) obj;
   if (destinationField == null) {
     if (other.destinationField != null) return false;
   } else if (!destinationField.equals(other.destinationField)) return false;
   return true;
 }
Exemplo n.º 7
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   TextureMapper other = (TextureMapper) obj;
   if (textureCoordLookup == null) {
     if (other.textureCoordLookup != null) return false;
   } else if (!textureCoordLookup.equals(other.textureCoordLookup)) return false;
   return true;
 }
Exemplo n.º 8
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    JSONObject that = (JSONObject) o;

    if (myHashMap != null ? !myHashMap.equals(that.myHashMap) : that.myHashMap != null)
      return false;

    return true;
  }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   CommunicationBean other = (CommunicationBean) obj;
   if (command == null) {
     if (other.command != null) return false;
   } else if (!command.equals(other.command)) return false;
   if (data == null) {
     if (other.data != null) return false;
   } else if (!data.equals(other.data)) return false;
   return true;
 }
  @Test
  public void testEquals() {
    TransportConfiguration configuration =
        new TransportConfiguration("SomeClass", new HashMap<String, Object>(), null);
    TransportConfiguration configuration2 =
        new TransportConfiguration("SomeClass", new HashMap<String, Object>(), null);

    Assert.assertEquals(configuration, configuration2);
    Assert.assertEquals(configuration.hashCode(), configuration2.hashCode());

    HashMap<String, Object> configMap1 = new HashMap<>();
    configMap1.put("host", "localhost");
    HashMap<String, Object> configMap2 = new HashMap<>();
    configMap2.put("host", "localhost");

    System.out.println("Equals::" + configMap1.equals(configMap2));
    configuration = new TransportConfiguration("SomeClass", configMap1, null);
    configuration2 = new TransportConfiguration("SomeClass", configMap2, null);
    Assert.assertEquals(configuration, configuration2);
    Assert.assertEquals(configuration.hashCode(), configuration2.hashCode());

    System.out.println("Equals::" + configMap1.equals(configMap2));
    configuration = new TransportConfiguration("SomeClass", configMap1, "name1");
    configuration2 = new TransportConfiguration("SomeClass", configMap2, "name2");
    Assert.assertNotEquals(configuration, configuration2);
    Assert.assertNotEquals(configuration.hashCode(), configuration2.hashCode());
    Assert.assertTrue(configuration.isEquivalent(configuration2));

    configMap1 = new HashMap<>();
    configMap1.put("host", "localhost");
    configMap2 = new HashMap<>();
    configMap2.put("host", "localhost3");
    configuration = new TransportConfiguration("SomeClass", configMap1, null);
    configuration2 = new TransportConfiguration("SomeClass", configMap2, null);
    Assert.assertNotEquals(configuration, configuration2);
    Assert.assertNotEquals(configuration.hashCode(), configuration2.hashCode());
  }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   PojoBar other = (PojoBar) obj;
   if (concurrentHashMap == null) {
     if (other.concurrentHashMap != null) return false;
   } else if (!concurrentHashMap.equals(other.concurrentHashMap)) return false;
   if (concurrentMap == null) {
     if (other.concurrentMap != null) return false;
   } else if (!concurrentMap.equals(other.concurrentMap)) return false;
   if (concurrentNavigableMap == null) {
     if (other.concurrentNavigableMap != null) return false;
   } else if (!concurrentNavigableMap.equals(other.concurrentNavigableMap)) return false;
   if (concurrentSkipListMap == null) {
     if (other.concurrentSkipListMap != null) return false;
   } else if (!concurrentSkipListMap.equals(other.concurrentSkipListMap)) return false;
   if (hashMap == null) {
     if (other.hashMap != null) return false;
   } else if (!hashMap.equals(other.hashMap)) return false;
   if (hashtable == null) {
     if (other.hashtable != null) return false;
   } else if (!hashtable.equals(other.hashtable)) return false;
   if (identityHashMap == null) {
     if (other.identityHashMap != null) return false;
   } else if (!identityHashMap.equals(other.identityHashMap)) return false;
   if (linkedHashMap == null) {
     if (other.linkedHashMap != null) return false;
   } else if (!linkedHashMap.equals(other.linkedHashMap)) return false;
   if (map == null) {
     if (other.map != null) return false;
   } else if (!map.equals(other.map)) return false;
   if (navigableMap == null) {
     if (other.navigableMap != null) return false;
   } else if (!navigableMap.equals(other.navigableMap)) return false;
   if (sortedMap == null) {
     if (other.sortedMap != null) return false;
   } else if (!sortedMap.equals(other.sortedMap)) return false;
   if (treeMap == null) {
     if (other.treeMap != null) return false;
   } else if (!treeMap.equals(other.treeMap)) return false;
   if (weakHashMap == null) {
     if (other.weakHashMap != null) return false;
   } else if (!weakHashMap.equals(other.weakHashMap)) return false;
   return true;
 }
 /** Stores new key bindings into Preferences, provided they actually differ from the old ones. */
 public void setNewKeyBindings(HashMap<String, String> newBindings) {
   if (!newBindings.equals(keyBinds)) {
     // This confirms that the bindings have actually changed.
     String[] bindNames = new String[newBindings.size()],
         bindings = new String[newBindings.size()];
     int index = 0;
     for (Iterator<String> i = newBindings.keySet().iterator(); i.hasNext(); ) {
       String nm = i.next();
       String bnd = newBindings.get(nm);
       bindNames[index] = nm;
       bindings[index] = bnd;
       index++;
     }
     putStringArray("bindNames", bindNames);
     putStringArray("bindings", bindings);
     keyBinds = newBindings;
   }
 }
Exemplo n.º 13
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   URL other = (URL) obj;
   if (host == null) {
     if (other.host != null) return false;
   } else if (!host.equals(other.host)) return false;
   if (parameters == null) {
     if (other.parameters != null) return false;
   } else if (!parameters.equals(other.parameters)) return false;
   if (port != other.port) return false;
   if (protocol == null) {
     if (other.protocol != null) return false;
   } else if (!protocol.equals(other.protocol)) return false;
   return true;
 }
  /**
   * @Method Name : goToUrl @Date : 2009. 3. 18. @Modify Info : @Method Description : 페이지 이동 메소드
   *
   * @param request
   * @param moveType location, back, parent
   * @param url
   * @param msg
   * @param parameter OST, GET
   * @param methodType
   * @throws Exception
   */
  public void goToUrl(
      HttpServletRequest request,
      String moveType,
      String url,
      String msg,
      HashMap parameter,
      String methodType)
      throws Exception {
    HashMap paramObject = new HashMap();
    ArrayList paramsArray = new ArrayList();

    paramObject.put("methodType", methodType);
    paramObject.put("moveType", moveType);
    paramObject.put("url", url);
    paramObject.put("msg", msg);

    if (!parameter.equals(new HashMap())) {
      String parameterString = this.getJSONObjectCastionParam(parameter);
      String[] parameterArray = parameterString.split("&");

      for (int i = 0; i < parameterArray.length; i++) {
        HashMap detailParameter = new HashMap();

        if (parameterArray[i].split("=").length == 2) {
          detailParameter.put("keyName", parameterArray[i].split("=")[0]);
          detailParameter.put("keyValue", parameterArray[i].split("=")[1]);
        } else {
          detailParameter.put("keyName", parameterArray[i].split("=")[0]);
          detailParameter.put("keyValue", "");
        }

        paramsArray.add(detailParameter);
      }
    }

    paramObject.put("params", paramsArray);
    request.setAttribute("parameter", paramObject);
  }
Exemplo n.º 15
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Character character = (Character) o;

    if (goldpieces != character.goldpieces) return false;
    if (hitpoints != character.hitpoints) return false;
    if (allAttributes != null
        ? !allAttributes.equals(character.allAttributes)
        : character.allAttributes != null) return false;
    if (attributeNames != null
        ? !attributeNames.equals(character.attributeNames)
        : character.attributeNames != null) return false;
    if (playerClass != null
        ? !playerClass.equals(character.playerClass)
        : character.playerClass != null) return false;
    if (races != null ? !races.equals(character.races) : character.races != null) return false;
    if (rand != null ? !rand.equals(character.rand) : character.rand != null) return false;

    return true;
  }
  public void action() {
    roughcores();

    HashMap<Integer, Integer> oldmin = new HashMap<Integer, Integer>();
    HashMap<Integer, Integer> min = new HashMap<Integer, Integer>();
    boolean finished = false;

    int iteration = 1;
    while (!finished && iteration < 50) {
      iteration++;
      finished = true;

      for (int i = 0; i < nodenum; i++) {
        propagate_bbc(i, oldmap, newmap);
      }

      if (id(oldmap).equals(id(newmap))) {
        //	 min = mc(min,count(newmap));
        min = mc(count(oldmap), count(newmap));
      } else {
        min = count(newmap);
      }

      if (!min.equals(oldmin)) {
        for (int i = 0; i < nodenum; i++) {
          oldmap[i].clear();
          oldmap[i].putAll(newmap[i]);
        }

        oldmin.clear();
        oldmin.putAll(min);

        finished = false;
      }
    }

    HashMap<Integer, HashSet<Integer>> coms = new HashMap<Integer, HashSet<Integer>>();
    HashMap<Integer, HashSet<Integer>> sub = new HashMap<Integer, HashSet<Integer>>();

    for (int x = 0; x < nodenum; x++) {
      HashSet<Integer> ids = id(x, oldmap);

      for (Integer in : ids) {
        if (coms.containsKey(in) && sub.containsKey(in)) {
          HashSet<Integer> set = new HashSet<Integer>();
          set.addAll(coms.get(in));
          set.add(x);
          coms.remove(in);
          coms.put(in, set);

          HashSet<Integer> intersect = intersection(sub.get(in), ids);
          sub.remove(in);
          sub.put(in, intersect);
        } else {

          HashSet<Integer> set = new HashSet<Integer>();
          set.add(x);
          coms.put(in, set);
          sub.put(in, ids);
        }
      }
    }

    int communitynumber = coms.size();

    /*
    int communityindex = 0;

    System.out.println("there are totally  "+ communitynumber + " communities.");
    for(Integer in : coms.keySet())
    {
    	System.out.println("subcommunity " + communityindex+" :");
    	for(Integer node : coms.get(in))
    	{
    		System.out.print((node+1) + " ");
    		belong[node].add(communityindex);
    	}

    	System.out.println();
    	communityindex++;
    }
    */

    Community com[] = new Community[communitynumber];
    for (int i = 0; i < communitynumber; i++) com[i] = new Community();

    int index = 0;
    for (Integer in : coms.keySet()) {
      for (Integer node : coms.get(in)) {

        com[index].nodelist.add(node);
      }

      index++;
    }

    for (int i = 0; i < communitynumber; i++) {

      boolean caninsert = true;
      for (int j = 0; j < communitylist.size(); j++)
        if (same(com[i], communitylist.get(j))) caninsert = false;

      if (caninsert) communitylist.add(com[i]);
    }
  }
Exemplo n.º 17
0
 public boolean isAnagram(String s, String t) {
   HashMap<Integer, Integer> mapS = getStringHashMap(s);
   HashMap<Integer, Integer> mapT = getStringHashMap(t);
   return mapS.equals(mapT);
 }
  /**
   * Compares another objects for equality to this comparator. The comparators are equal if they
   * have the same sort order.
   *
   * @param o The object to compare against this one
   * @return true if this is equal to this class
   */
  public boolean equals(Object o) {
    if (!(o instanceof LoadPriorityComparator)) return false;

    return priorityMap.equals(((LoadPriorityComparator) o).priorityMap);
  }
Exemplo n.º 19
0
 /**
  * Method to check the equality of this map, and another.
  *
  * @param o The map to compare against.
  * @return Whether they are equal.
  */
 public synchronized boolean equals(Object o) {
   return delegate.equals(o);
 }