Example usage for java.lang Float floatToIntBits

List of usage examples for java.lang Float floatToIntBits

Introduction

In this page you can find the example usage for java.lang Float floatToIntBits.

Prototype

@HotSpotIntrinsicCandidate
public static int floatToIntBits(float value) 

Source Link

Document

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.

Usage

From source file:eu.eexcess.domaindetection.wordnet.XwndReader.java

public void read(File file) throws IOException {
    String domain = FilenameUtils.getBaseName(file.getName());

    File cacheFile = new File(file.getPath() + ".cache");
    if (!cacheFile.exists()) {
        BinaryOutputStream bos = new BinaryOutputStream(new FileOutputStream(cacheFile));
        System.out.println("Read in the Extended WordNet Domains file: " + file);
        LineIterator iterator = new LineIterator(new FileReader(file));
        while (iterator.hasNext()) {
            String line = iterator.nextLine();
            String[] tokens = line.split("\t");
            String synset = tokens[0];
            double weight = Double.parseDouble(tokens[1]);
            String[] ssid = synset.split("-");
            int nr = Integer.parseInt(ssid[0]);
            POS pos = POS.getPOSForKey(ssid[1]);
            bos.writeInt(nr);/*from   w ww.  j  a  v  a  2s .  c o m*/
            bos.writeSmallInt(pos.getId());
            bos.writeInt(Float.floatToIntBits((float) weight));
        }
        iterator.close();
        bos.close();
    }

    System.out.println("Read in the Extended WordNet Domains cache file: " + file);
    FileInputStream fStream = new FileInputStream(cacheFile);
    BinaryInputStream bis = new BinaryInputStream(fStream);
    while (bis.available() > 0) {
        int nr = bis.readInt();
        int key = bis.readSmallInt();
        POS pos = POS.getPOSForId(key);
        String synset = String.format("%08d-%s", nr, pos.getKey());
        double weight = Float.intBitsToFloat(bis.readInt());
        DomainAssignment assignment = new DomainAssignment(domain, weight);
        Set<DomainAssignment> domains = synsetToDomains.get(synset);
        if (domains == null) {
            domains = new TreeSet<DomainAssignment>();
            synsetToDomains.put(synset, domains);
        }
        domains.add(assignment);
    }
    fStream.close();
    bis.close();
}

From source file:it.univaq.disim.mobile.cityshop.business.domain.Prodotto.java

@Override
public int hashCode() {
    int hash = 5;
    hash = 53 * hash + this.id;
    hash = 53 * hash + Objects.hashCode(this.nome);
    hash = 53 * hash + Objects.hashCode(this.descrizione);
    hash = 53 * hash + Float.floatToIntBits(this.prezzo);
    hash = 53 * hash + Objects.hashCode(this.foto);
    hash = 53 * hash + Objects.hashCode(this.categoria);
    hash = 53 * hash + Objects.hashCode(this.brand);
    hash = 53 * hash + Objects.hashCode(this.negozio);
    return hash;//ww  w.j  a  va  2 s. c om
}

From source file:com.quartercode.disconnected.sim.Location.java

@Override
public boolean equals(Object obj) {

    if (this == obj) {
        return true;
    }//  w w  w  .j  av  a2s.  co m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    Location other = (Location) obj;
    if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x)) {
        return false;
    }
    if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) {
        return false;
    }
    return true;
}

From source file:Main.java

/** Hash code for <tt>float</tt> primitives.  */
public static int hash(int aSeed, float aFloat) {

    return hash(aSeed, Float.floatToIntBits(aFloat));
}

From source file:com.cloudera.oryx.rdf.common.rule.NumericDecision.java

@Override
public int hashCode() {
    return getFeatureNumber() ^ Float.floatToIntBits(threshold);
}

From source file:org.ambientlight.config.room.entities.climate.DayEntry.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    DayEntry other = (DayEntry) obj;/*from   www .j a va 2  s  . co  m*/
    if (hour != other.hour)
        return false;
    if (min != other.min)
        return false;
    if (Float.floatToIntBits(temp) != Float.floatToIntBits(other.temp))
        return false;
    return true;
}

From source file:Vector3f.java

/**
 * {@inheritDoc}/*  w  w w .  j a v  a 2  s  .c  o  m*/
 */
public int hashCode() {
    int i1 = Float.floatToIntBits(this.x);
    int i2 = Float.floatToIntBits(this.y);
    int i3 = Float.floatToIntBits(this.z);

    return i1 ^ ((i2 << 8) | (i2 >>> 24)) ^ ((i3 << 16) | (i3 >>> 16));
}

From source file:uk.co.modularaudio.mads.base.interptester.ui.InterpTesterMadUiInstance.java

public void setChaseValueMillis(final float chaseMillis) {
    final long floatIntBits = Float.floatToIntBits(chaseMillis);
    sendTemporalValueToInstance(InterpTesterIOQueueBridge.COMMAND_CHASE_MILLIS, floatIntBits);
}

From source file:uk.co.modularaudio.mads.base.stereo_compressor.ui.StereoCompressorMadUiInstance.java

public void sendOneCurveAsFloat(final int command, final float guiDesiredValue) {
    final long value = (Float.floatToIntBits(guiDesiredValue));
    sendTemporalValueToInstance(command, value);
    propogateChange(command, guiDesiredValue);
}

From source file:Encdec.java

public static int enc_floatle(float f, byte[] dst, int di) {
    return enc_uint32le(Float.floatToIntBits(f), dst, di);
}