Examples of Rating


Examples of org.emftrace.metamodel.QUARCModel.Query.Rating

    applicableElementCache = new GSSQueryCache(queryResultSet, accessLayer);
    applicableElementCache.initCache();
 
   

    Rating r1 = applicableElementCache.createRatingRelation(si1, g1, 100.0f);
    Rating r2 =applicableElementCache.createRatingRelation(si2, g1, 50.0f);
   
   
    assertEquals(2, applicableElementCache.getRatingRelationsTo(g1).size());
    assertTrue( applicableElementCache.getRatingRelationsTo(g1).contains(r1));
    assertTrue( applicableElementCache.getRatingRelationsTo(g1).contains(r2));
View Full Code Here

Examples of org.emftrace.metamodel.QUARCModel.Query.Rating

   *            the weight (float)
   * @return the created Rating relation
   */
  protected Rating createRating(QueryResultSet queryResultSet,
      Element source, Element target, float weight) {
    Rating rating = QueryFactory.eINSTANCE.createRating();
    rating.setSource(source);
    rating.setTarget(target);
    rating.setWeight(String.valueOf(weight));
    queryResultSet.getRatings().add(rating);
    return rating;
  }
View Full Code Here

Examples of org.emftrace.metamodel.QUARCModel.Query.Rating

   *            the weight of the Rating relation
   * @return the created ApplicableElement
   */
  public Rating createRatingRelation(Element sourceElement,
      Element targetElement, float weight) {
    Rating rating = QueryFactory.eINSTANCE.createRating();
    rating.setSource(sourceElement);
    rating.setTarget(targetElement);
    rating.setWeight(String.valueOf(weight));
    getQueryResultSet().getRatings().add(rating);
    addRatingToCache(rating, sourceElement, targetElement, weight);
    return rating;
  }
View Full Code Here

Examples of org.emftrace.metamodel.QUARCModel.Query.Rating

   *            the target Element of a Rating relation
   * @return the weight of the found Rating relation between the specified
   *         Elements
   */
  public float getRatingWeight(Element sourceElement, Element targetElement) {
    Rating rating = getRatingRelation(sourceElement, targetElement);
    if (rating != null)
      return ratingsWeightCache.get(rating);
    else
      return 0.0f;
  }
View Full Code Here

Examples of org.emftrace.metamodel.QUARCModel.Query.Rating

   * @return the weight of the found Rating relation between the specified
   *         Elements
   */
  public float getIndirectRatingWeight(Element sourceElement,
      Element targetElement) {
    Rating rating = getRatingRelation(sourceElement, targetElement);
    if (rating != null)
      return ratingsWeightCache.get(rating);
    float ratingSum = 0.0f;
    int count = 0;

View Full Code Here

Examples of org.grouplens.lenskit.data.event.Rating

    }

    @Theory
    public void testRenderRating(BinaryFormat format) {
        long ts = format.hasTimestamps() ? 34208L : -1;
        Rating r = Ratings.make(42L, 39L, Math.PI, ts);
        ByteBuffer buf = ByteBuffer.allocate(format.getRatingSize());
        format.renderRating(r, buf);
        buf.flip();

        buf.mark();
        MutableRating r2 = new MutableRating();
        format.readRating(buf, r2);
        assertThat(r2, equalTo(r));

        buf.reset();
        Rating r3 = format.readRating(buf);
        assertThat(r3, equalTo(r));
    }
View Full Code Here

Examples of org.grouplens.lenskit.data.event.Rating

        assertThat(history.getUserId(), equalTo(42L));
    }

    @Test
    public void testSingletonList() {
        Rating r = Ratings.make(42, 39, 2.5);
        UserHistory<Rating> history = History.forUser(42, ImmutableList.of(r));
        assertThat(history.size(), equalTo(1));
        assertThat(history.isEmpty(), equalTo(false));
        assertThat(history.getUserId(), equalTo(42L));
        assertThat(history, contains(r));
View Full Code Here

Examples of org.internna.iwebmvc.model.Rating

                    for (Locale l : supportedLocales) o.getIdentifier().add(l, l + ":" + StringUtils.SHA1(String.valueOf(aux)));
              } catch (Exception e) {};
                o.getAmount().setAmount(aux * 1024 * 1024);
                o.getAmount().setCurrency(aux > 0.5 ? usd : eur);
                o.setOrderNumber(num++);
                o.setPriority(new Rating());
                o.getPriority().setRating(Double.valueOf(Math.round(aux * 10) % 5));
                o.setEmitted(emitted);
                calendar.add(Calendar.DATE, (int) Math.round(aux * 10));
                o.setEmissionDate(calendar.getTime());
                try {
View Full Code Here

Examples of org.internna.iwebmvc.model.Rating

*/
public class RatingConverter extends AbstractConverter {

    @Override public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException {
      if (!data.isNull()) {
            Rating rating = new Rating();
            try {
                String points = data.getValue();
                rating.setRating(hasText(points) ? Double.parseDouble(points) : 0D);
                return rating;
            } catch (Exception e) {
                throw new ConversionException(paramType, new IWebMvcException("Could not convert Rating from: " + data, e));
            }
      }
View Full Code Here

Examples of org.internna.iwebmvc.model.core.Rating

*/
public class RatingBinder extends PropertyEditorSupport {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        Rating r = (Rating) getValue();
        if (StringUtils.hasText(text)) {
            if (r == null) r = new Rating();
            r.setRating(Double.parseDouble(text));
        }
        setValue(r);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.