Package java.lang

Examples of java.lang.Float


            String[] wordForms = A_prime[i].getWordForms();
            for (int j = 0; j < wordForms.length; j++)
            {
                if (wordForms[j].compareTo(A) != 0) {
                    //Search corpus... A':B
                    Float score = new Float(countPhraseFrequencies(INDEX_DIR, wordForms[j], B));
                    phrase_frequencies.put(score,new Pair<String>(wordForms[j],B));
                    count++;
                }

                if(count >= NUM_SIM)
                    break;
            }
            if(count >= NUM_SIM)
                break;
        }
        count = 0;
        for (int i = 0; (i < NUM_SIM && i < B_prime.length); i++) {
            String[] wordForms = B_prime[i].getWordForms();
            for (int j = 0; j < wordForms.length; j++)
            {
                if (wordForms[j].compareTo(B) != 0) {
                    //Search corpus... A:B'
                    Float score = new Float(countPhraseFrequencies(INDEX_DIR,A, wordForms[j]));
                    phrase_frequencies.put(score,new Pair<String>(A,wordForms[j]));
                    count++;
                }

                if(count >= NUM_SIM)
                    break;
            }
            if(count >= NUM_SIM)
                break;
        }
       
        // filter out the phrases and add the top 3 to the ArrayList, and return it
        Iterator iter = phrase_frequencies.keySet().iterator();
        //TODO: make number of filters dynamic
        //create Array with size = num filters
        ArrayList<String> filtered_phrases = new ArrayList<String>();
        Float filter1 = new Float(0.0);
        Float filter2 = new Float(0.0);
        Float filter3 = new Float(0.0);
        while (iter.hasNext()) {
            Float curr_key = (Float)iter.next();
            //this will bump the filters up each time a greater value comes along
            //so that filter1 will be the greatest key and filter3 the 3rd greatest
            if (curr_key > filter1) {
                filter3 = filter2;
                filter2 = filter1;
View Full Code Here


    public void testMultiplyFloat() {
  String file = "prog-test/mul-float.cam";
  Main m = new Main();
  float result = (float)4.5 * (float)2.2;
  assertEquals("Multiply two floats",
         new Float(result).toString(),
         m.testingProgram(file, "main__main"));
    }
View Full Code Here

    public void testDivInteger() {
  String file = "prog-test/div-int.cam";
  Main m = new Main();
  assertEquals("Testing integer division",
         new Float(2).toString(),
         m.testingProgram(file, "main__main"));
  assertEquals("Testing integer division by 0",
         "Integer division: 0 in denominator!",
         m.testingProgram(file, "main__main2"));
    }
View Full Code Here

    public void testDivFloat() {
  String file = "prog-test/div-float.cam";
  Main m = new Main();
  assertEquals("Testing float division",
         new Float(3).toString(),
         m.testingProgram(file, "main__main"));
  assertEquals("Testing float division by 0",
         "Float division: 0 in denominator!",
         m.testingProgram(file, "main__cero"));
View Full Code Here

    public int work(float[] buffer)throws AOException{
  int returned = this.previous[0].nextWork(buffer);
  if (sampleCounter >= sampleDelay) {
      for(int i=0;i<returned;i++){
    // keep the current sample from the chain
    storedSamples.addElement(new Float(buffer[i]));
    // replace it with a stored sample
    Float tempFloat = (Float)storedSamples.elementAt(storedSamples.size()-1);
    buffer[i] = tempFloat.floatValue();
    // remove the used stored sample
    storedSamples.removeElementAt(storedSamples.size()-1);
      }
     
  } else { // early on pad with silence
      for(int i=0;i<returned;i++){
    // keep the current sample from the chain
    storedSamples.addElement(new Float(buffer[i]));
    // send out a zero value
    buffer[i] = (float)0.0;
      }
  }
 
View Full Code Here

TOP

Related Classes of java.lang.Float

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.