Example usage for java.util Objects hashCode

List of usage examples for java.util Objects hashCode

Introduction

In this page you can find the example usage for java.util Objects hashCode.

Prototype

public static int hashCode(Object o) 

Source Link

Document

Returns the hash code of a non- null argument and 0 for a null argument.

Usage

From source file:cal.binBased.Calculate_BinSpectrum_Similarity.java

@Override
public int hashCode() {
    int hash = 5;
    hash = 11 * hash + Objects.hashCode(this.bin_specA);
    hash = 11 * hash + Objects.hashCode(this.bin_specB);
    hash = 11 * hash + Objects.hashCode(this.sim_method);
    hash = 11 * hash/*from   w ww.ja  v a 2 s .co  m*/
            + (int) (Double.doubleToLongBits(this.score) ^ (Double.doubleToLongBits(this.score) >>> 32));
    hash = 11 * hash + (int) (Double.doubleToLongBits(this.fragmentTolerance)
            ^ (Double.doubleToLongBits(this.fragmentTolerance) >>> 32));
    hash = 11 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
    hash = 11 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
    hash = 11 * hash + (this.isScoreCalculated ? 1 : 0);
    return hash;
}

From source file:gr.csri.poeticon.praxicon.db.entities.RelationSet.java

@Override
public int hashCode() {
    int hash = 5;
    hash = 13 * hash + Objects.hashCode(this.name);
    hash = 13 * hash + Objects.hashCode(this.relations);
    hash = 13 * hash + Objects.hashCode(this.languageRepresentations);
    return hash;/*from w  ww  .jav a 2  s.  c  o  m*/
}

From source file:it.iit.genomics.cru.structures.model.MoleculeEntry.java

@Override
public int hashCode() {
    int hash = 7;
    hash = 71 * hash + Objects.hashCode(this.uniprotAc);
    hash = 71 * hash + Objects.hashCode(this.taxid);
    hash = 71 * hash + Objects.hashCode(this.organism);
    hash = 71 * hash + Objects.hashCode(this.geneNames);
    return hash;//  w w  w  .  jav  a 2 s  .c  om
}

From source file:com.erudika.scoold.core.Profile.java

public int hashCode() {
    return Objects.hashCode(getName()) + Objects.hashCode(getId());
}

From source file:eu.mihosoft.vrl.v3d.Edge.java

@Override
public int hashCode() {
    int hash = 7;
    hash = 71 * hash + Objects.hashCode(this.p1);
    hash = 71 * hash + Objects.hashCode(this.p2);
    return hash;/* w w w. j av a2  s. co m*/
}

From source file:de.austinpadernale.holidays.Holiday.java

@Override
public int hashCode() {
    int hash = 7;
    hash = 29 * hash + Objects.hashCode(this.names);
    hash = 29 * hash + Objects.hashCode(this.shifts);
    hash = 29 * hash + Objects.hashCode(this.validities);
    hash = 29 * hash + Objects.hashCode(this.holidayType);
    hash = 29 * hash + Objects.hashCode(this.day);
    hash = 29 * hash + Objects.hashCode(this.month);
    hash = 29 * hash + Objects.hashCode(this.offset);
    return hash;/*from   w ww.  j  av a 2  s  .  c  om*/
}

From source file:libepg.epg.section.Section.java

/**
 * @return ????????//ww w.  j  av a2s . c  o m
 */
@Override
public final int hashCode() {
    int hash = 7;
    hash = 73 * hash + Objects.hashCode(this.data.hashCode());
    hash = 73 * hash + Objects.hashCode(this.tableId);
    return hash;
}

From source file:com.ndemyanovskyi.backend.site.Site.java

@Override
public int hashCode() {
    int hash = 7;
    hash = 67 * hash + Objects.hashCode(this.mainUrl);
    return hash;
}

From source file:com.erudika.scoold.core.Post.java

public int hashCode() {
    return Objects.hashCode(getTitle()) + Objects.hashCode(getBody()) + Objects.hashCode(getTags());
}

From source file:fr.landel.utils.assertor.OperatorTest.java

/**
 * Test method for {@link Operator#or()}.
 *///from w  ww. ja va 2 s . co  m
@Test
public void testOr() {
    final String text = "text";
    assertTrue(Assertor.that(text).isEmpty().or().isNotBlank().isOK());

    assertTrue(Assertor.that(text).isEmpty().or(true).isTrue().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(true).isFalse().isOK());

    assertTrue(Assertor.that(text).isEmpty().or(text.getClass()).isAssignableFrom(CharSequence.class).isOK());
    assertFalse(Assertor.that(text).isEmpty().or(text.getClass()).isAssignableFrom(StringBuilder.class).isOK());

    assertTrue(Assertor.that(text).isEmpty().or(Calendar.getInstance())
            .isAfter(DateUtils.getCalendar(new Date(0))).isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Calendar.getInstance())
            .isBefore(DateUtils.getCalendar(new Date(0))).isOK());

    assertTrue(Assertor.that(text).isEmpty().or(new Date()).isAfter(new Date(0)).isOK());
    assertFalse(Assertor.that(text).isEmpty().or(new Date()).isBefore(new Date(0)).isOK());

    assertTrue(Assertor.that(text).isEmpty().or(LocalDateTime.now()).isAfter(LocalDateTime.MIN).isOK());
    assertFalse(Assertor.that(text).isEmpty().or(LocalDateTime.now()).isAfter(LocalDateTime.MAX).isOK());

    assertTrue(Assertor.that(text).isEmpty().or(2).isGT(1).isOK());
    assertFalse(Assertor.that(text).isEmpty().or(2).isLT(1).isOK());

    assertTrue(Assertor.that(text).isEmpty().or("tt").isNotEmpty().isOK());
    assertFalse(Assertor.that(text).isEmpty().or("tt").isEmpty().isOK());

    assertTrue(Assertor.that(text).isEmpty().or(new String[] {}).isEmpty().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(new String[] {}).isNotEmpty().isOK());
    assertTrue(Assertor.that(text).isEmpty().or(new String[] {}, EnumAnalysisMode.STREAM).isEmpty().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(new String[] {}, EnumAnalysisMode.STREAM).isNotEmpty().isOK());
    assertTrue(Assertor.that(text).isEmpty().or(new String[] {}, EnumAnalysisMode.PARALLEL).isEmpty().isOK());
    assertFalse(
            Assertor.that(text).isEmpty().or(new String[] {}, EnumAnalysisMode.PARALLEL).isNotEmpty().isOK());

    assertTrue(Assertor.that(text).isEmpty().or(Collections.emptyList()).isEmpty().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Collections.emptyList()).isNotEmpty().isOK());
    assertTrue(Assertor.that(text).isEmpty().or(Collections.emptyList(), EnumAnalysisMode.STREAM).isEmpty()
            .isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Collections.emptyList(), EnumAnalysisMode.STREAM).isNotEmpty()
            .isOK());
    assertTrue(Assertor.that(text).isEmpty().or(Collections.emptyList(), EnumAnalysisMode.PARALLEL).isEmpty()
            .isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Collections.emptyList(), EnumAnalysisMode.PARALLEL)
            .isNotEmpty().isOK());

    assertTrue(Assertor.that(text).isEmpty().or(Collections.emptyMap()).isEmpty().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Collections.emptyMap()).isNotEmpty().isOK());
    assertTrue(
            Assertor.that(text).isEmpty().or(Collections.emptyMap(), EnumAnalysisMode.STREAM).isEmpty().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Collections.emptyMap(), EnumAnalysisMode.STREAM).isNotEmpty()
            .isOK());
    assertTrue(Assertor.that(text).isEmpty().or(Collections.emptyMap(), EnumAnalysisMode.PARALLEL).isEmpty()
            .isOK());
    assertFalse(Assertor.that(text).isEmpty().or(Collections.emptyMap(), EnumAnalysisMode.PARALLEL).isNotEmpty()
            .isOK());

    assertTrue(Assertor.that(text).isEmpty().or((Object) 0).isNotNull().isOK());
    assertFalse(Assertor.that(text).isEmpty().or((Object) 0).isNull().isOK());

    assertTrue(Assertor.that(text).isEmpty().or(new Exception()).isNotNull().isOK());
    assertFalse(Assertor.that(text).isEmpty().or(new Exception()).isNull().isOK());

    assertTrue(Assertor.that(Color.BLACK).isNull().or().isEqual(Color.black).isOK());
    assertTrue(Assertor.that(Color.BLACK).isNull().or((Object) 0).isNotNull().isOK());

    assertTrue(Assertor.that(Color.BLACK).isNotNull().or(Assertor.that(text).isEmpty()).isOK());

    assertTrue(
            Assertor.that(true).isFalse().or(Assertor.that("text").startsWith("t").and().contains("e")).isOK());

    // SUB ASSERTOR

    assertTrue(Assertor.that(text).isNotEmpty().orAssertor(t -> Assertor.that(t.length()).isGT(4)).isOK());
    assertEquals(
            "the char sequence 'text' should be null or empty OR (the number '4' should be greater than '4')",
            Assertor.that(text).isEmpty().orAssertor(t -> Assertor.that(t.length()).isGT(4)).getErrors().get());

    assertException(() -> Assertor.that(text).isNotEmpty()
            .orAssertor((Function<String, StepCharSequence<String>>) null).isOK(), IllegalStateException.class,
            "sub assertor cannot be null");

    // MAPPER

    assertTrue(Assertor.that(true).isTrue().orObject(b -> b.toString()).hasHashCode(Objects.hashCode("true"))
            .isOK());
    assertTrue(Assertor.that(true).isTrue().orCharSequence(b -> b.toString()).contains("ue").isOK());
    assertTrue(Assertor.that("test").isNotEmpty()
            .orArray(s -> ArrayUtils.toObject(s.getBytes(StandardCharsets.UTF_8))).contains((byte) 'e').isOK());
    assertTrue(Assertor.that(true).isTrue().orBoolean(b -> !b).isFalse().isOK());
    assertTrue(Assertor.that(true).isTrue().orClass(b -> b.getClass()).hasSimpleName("Boolean").isOK());
    assertTrue(Assertor.that(true).isTrue().orDate(b -> new Date(1464475553641L))
            .isAfter(new Date(1464475553640L)).isOK());
    assertTrue(Assertor.that(true).isTrue().orCalendar(b -> DateUtils.getCalendar(new Date(1464475553641L)))
            .isBefore(Calendar.getInstance()).isOK());
    assertTrue(
            Assertor.that(true).isTrue().orTemporal(b -> DateUtils.getLocalDateTime(new Date(1464475553641L)))
                    .isBefore(LocalDateTime.now()).isOK());
    assertTrue(Assertor.that(true).isTrue().orEnum(b -> EnumOperator.AND).hasName("AND").isOK());
    assertTrue(Assertor.that(true).isTrue().orIterable(b -> Arrays.asList('t', 'r')).contains('t').isOK());
    assertTrue(Assertor.that(true).isTrue().orMap(b -> MapUtils2.newHashMap("key", b)).contains("key", true)
            .isOK());
    assertTrue(Assertor.that(true).isTrue().orNumber(b -> b.hashCode()).isGT(0).isOK()); // 1231
    assertTrue(Assertor.that(true).isTrue().orThrowable(b -> new IOException(b.toString()))
            .validates(e -> e.getMessage().contains("true")).isOK());
}