Package de.kunysch.localimdb

Examples of de.kunysch.localimdb.Movie


  public static void main(String[] args) {
    junit.swingui.TestRunner.run(MovieTest.class);
  }

  private final Movie copyMovie(Movie movie) {
    Movie copy = new Movie();
    copy.setYear(movie.getYear());
    copy.setRating(movie.getRank(), movie.getVotes());
    return copy;
  }
View Full Code Here


  }

  private Movie movieDefault, movieA, movieA2, movieB;

  protected void setUp() throws Exception {
    movieDefault = new Movie();
    movieA = new Movie();
    movieA.setYear(1934);
    movieA.setRating(100, 12345);
    movieA2 = copyMovie(movieA);
    movieB = copyMovie(movieA);
    movieB.setYear(movieB.getYear() - 1);
View Full Code Here

      movieA.writeExternal(out);
      movieA2.writeExternal(out);
      movieB.writeExternal(out);
      out.close();
      final ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
      final Movie readMovie = new Movie();
      readMovie.readExternal(in);
      assertEquals(movieDefault, readMovie);
      readMovie.readExternal(in);
      assertEquals(movieA, readMovie);
      readMovie.readExternal(in);
      assertEquals(movieA2, readMovie);
      readMovie.readExternal(in);
      assertEquals(movieB, readMovie);
    } catch (IOException e) {
      fail(e.toString());
    }
  }
View Full Code Here

    assertTrue(builder.getMovies().isEmpty());
  }

  public final void testAddOrGetMovie() {
    assertTrue(builder.getMovies().isEmpty());
    Movie one = builder.addOrGetMovie("A Title (2005)");
    one.setYear(2005);
    assertFalse(builder.getMovies().isEmpty());
    assertEquals(1, builder.getMovies().getMovieCount());
    Movie two = builder.addOrGetMovie("A Title (2005)");
    assertEquals(2005, two.getYear());
    assertEquals(1, builder.getMovies().getMovieCount());
    Movie three = builder.addOrGetMovie("Another Title (2005)");
    assertEquals(2, builder.getMovies().getMovieCount());
    assertEquals(0, three.getYear());
  }
View Full Code Here

  }

  public final void testAddTitle() {
    assertEquals(0, builder.getMovies().getMovieCount());
    assertEquals(0, builder.getMovies().getTitleCount());
    Movie one = builder.addOrGetMovie("One Title (2005)");
    Movie two = builder.addOrGetMovie("Two Title (2005)");
    assertEquals(2, builder.getMovies().getMovieCount());
    assertEquals(2, builder.getMovies().getTitleCount());
    builder.addTitle(one, "\"Title, One\"");
    assertEquals(2, builder.getMovies().getTitleCount());
    builder.addTitle(one, "Title, One");
View Full Code Here

  final static String titleG = "Title G";
  final static String titleH = "Title H";
  Movie movieOne, movieTwo, movieThree;

  protected void setUp() throws Exception {
    movieOne = new Movie();
    movieOne.setYear(1911);
    movieOne.setRating(11, 11111);
    movieTwo = new Movie();
    movieTwo.setYear(2122);
    movieThree = new Movie();
    moviesDefault = new Movies();
    long[] hashes = new long[1];
    List<Movie>[] movieList = new List[1];
    hashes[0] = Movies.hashTitle(titleG);
    movieList[0] =Arrays.asList(new Movie[] { movieOne });
View Full Code Here

   * @param pw
   * @param rprog
   */
  private static void printImdbData(PrintWriter pw, final RatedProgram rprog) {
    if (null != rprog) {
      final Movie mov = rprog.getMovie();
      pw.println("<td>" + mov.getRank() / 10.0 + ", " + mov.getVotes() + ", " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          + mov.getYear() + "</td>"); //$NON-NLS-1$
    }
    pw.print("</tr>"); //$NON-NLS-1$
  }
View Full Code Here

    if (null != omovies) {
      allMovies.addAll(omovies);
    }
    final Iterator<Movie> iter = allMovies.iterator();
    while (iter.hasNext()) {
      final Movie movie = iter.next();
      final boolean fromTitle = movies.contains(movie);
      final boolean fromOrigTitle = null != omovies && omovies.contains(movie);
      rows.add(RatedProgram.Handler.create(prog, movie, null, fromTitle, fromOrigTitle));
    }
  }
View Full Code Here

          } catch (InvalidParameterException e) {
          }
        }
      };
      if (movies[0].size() == 1) {
        Movie movie = movies[0].iterator().next();
        Object[] args = { movie.getRank() / 10.0, movie.getVotes() };
        label = mLocalizer.msg("showRatingSingle", "Show IMDb rating (\u2205 {0,number,#.#} #{1})", args);
      }
    }
    action.putValue(Action.NAME, label);
    action.putValue(Action.SMALL_ICON, getLogoIcon());
View Full Code Here

      return;
    }
    final int minVotes = getSettings().getInt(SettingsKeys.MINVOTES);
    Iterator iter = set.iterator();
    while (iter.hasNext()) {
      Movie movie = (Movie) iter.next();
      if (movie.getVotes() < minVotes) {
        iter.remove();
      }
    }
  }
View Full Code Here

TOP

Related Classes of de.kunysch.localimdb.Movie

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.