Esempio n. 1
0
  /**
   * Test the creation of port.
   *
   * @throws Exception
   */
  @Test
  public void testPort() throws Exception {

    Port port = new Port("name", "networkId", "tenantId", "deviceOwner", "portId");
    Port port2 = new Port("name2", "networkId", "tenantId", "deviceOwner", "2");
    assertEquals(port.getName(), "name");
    assertEquals(port.getNetworkId(), "networkId");
    assertEquals(port.equals(port2), false);
  }
Esempio n. 2
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    PortHistory that = (PortHistory) o;

    return id == that.id
        && !(port != null ? !port.equals(that.port) : that.port != null)
        && !(date != null ? !date.equals(that.date) : that.date != null);
  }
Esempio n. 3
0
  public boolean equals(Object o) {

    if (o == this) return true;
    if (!(o instanceof TFN)) return false;
    TFN tfno = (TFN) o;
    if (empty && tfno.empty) return true;
    return (!empty)
        && (!tfno.empty)
        && m.equals(tfno.m)
        && p.equals(tfno.p)
        && pfn.equals(tfno.pfn);
  }
Esempio n. 4
0
  /**
   * Term comparison method
   *
   * @return true if the input Term is equal to the object, false otherwize
   */
  public boolean equal(Term _any) {

    try {

      /* Pids */
      if ((PidV != null) && (_any.PidV != null)) if (PidV.equal(_any.PidV)) return true;

      /* Refs */
      if ((RefV != null) && (_any.RefV != null)) if (RefV.equal(_any.RefV)) return true;

      /* Ports */
      if ((PortV != null) && (_any.PortV != null)) if (PortV.equals(_any.PortV)) return true;

      /* strings */
      if ((stringV != null) && (_any.stringV != null))
        if (stringV.equals(_any.stringV)) return true;

      /* atoms and booleans */
      if ((atomV != null) && (_any.atomV != null)) if (atomV.equals(_any.atomV)) return true;

      /* booleans */
      if (atomV != null) if (_any.booleanV == Boolean.valueOf(atomV).booleanValue()) return true;

      if (_any.atomV != null)
        if (booleanV == Boolean.valueOf(_any.atomV).booleanValue()) return true;

      /* integer types plus floating point types */
      double _ownNS = longV + doubleV;

      double _othersNS = _any.longV + _any.doubleV;

      if ((equal(_ownNS, _othersNS)) && (!equal(_ownNS, 0))) return true;

      /* All together, 0 or false */
      if ((equal(_ownNS, _othersNS)) && booleanV == _any.booleanV) return true;

      return false;

    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }