Package org.silverpeas.components.survey.web

# Class AnswerPercentEntity

java.lang.Object
org.silverpeas.components.survey.web.AnswerPercentEntity

All Implemented Interfaces:
  `Serializable`, `org.silverpeas.core.web.rs.WebEntity`

public class AnswerPercentEntity extends Object implements org.silverpeas.core.web.rs.WebEntity
This is a representation of an answer percent against other answer percents of a question.

Author:
  silveryocha
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AnswerPercentEntity()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static List<AnswerPercentEntity>`
  `asWebEntities(Collection<org.silverpeas.core.questioncontainer.answer.model.Answer> answers, int nbVoters, boolean isUsers)`
  Gets the given collection of answers to a question into a list of `AnswerPercentEntity` instances.
  `AnswerEntity`
  `getAnswer()`
  The WEB entity representation of an `Answer`.
  `BigDecimal`
  `getPercent()`
  The percent representation of the answer against the others for a question.
  `URI`
  `getURI()`
  `void`
  `setAnswer(AnswerEntity answer)`
  `void`
  `setPercent(BigDecimal percent)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AnswerPercentEntity

    protected AnswerPercentEntity()

- ## Method Details

  - ### asWebEntities

    public static List<AnswerPercentEntity> asWebEntities(Collection<org.silverpeas.core.questioncontainer.answer.model.Answer> answers, int nbVoters, boolean isUsers)
    Gets the given collection of answers to a question into a list of `AnswerPercentEntity` instances.
    Parameters:
      `answers` - answers to a question.
      `nbVoters` - the total number of survey voters.
      `isUsers` - false to shut down the percent computation, true otherwise.
    Returns:
      a list of `AnswerPercentEntity` instances.

  - ### getAnswer

    public AnswerEntity getAnswer()
    The WEB entity representation of an `Answer`.
    Returns:
      an `AnswerEntity` instance.

  - ### setAnswer

    public void setAnswer(AnswerEntity answer)

  - ### getPercent

    public BigDecimal getPercent()
    The percent representation of the answer against the others for a question.
    Returns:
      a `BigDecimal` instance.

  - ### setPercent

    public void setPercent(BigDecimal percent)

  - ### getURI

    public URI getURI()
    Specified by:
      `getURI` in interface `org.silverpeas.core.web.rs.WebEntity`