Class QuestionImpl

java.lang.Object
org.eu.zajc.akiwrapper.core.entities.impl.AbstractQuery
org.eu.zajc.akiwrapper.core.entities.impl.QuestionImpl
All Implemented Interfaces:
Query, Question

public class QuestionImpl extends AbstractQuery implements Question
Note: This is an internal class and its internals are subject to change without prior deprecation. Use with caution.

Author:
Marko Zajc
  • Method Details

    • fromJson

      @Nonnull public static QuestionImpl fromJson(@Nonnull AkiwrapperImpl akiwrapper, @Nonnull org.json.JSONObject json)
    • fromHtml

      public static QuestionImpl fromHtml(@Nonnull AkiwrapperImpl akiwrapper, @Nonnull org.jsoup.nodes.Element gameRoot)
    • answer

      public Query answer(Akiwrapper.Answer answer)
      Description copied from interface: Question
      This is an interaction method for Question.
      Submits an answer for the question and returns the next Query, incrementing the current step.
      If there are no more questions left, this will return null.
      Note: A single Question object can only be interacted with once. Calling Question.answer(Answer) or Question.undoAnswer() mutates the session state, so you can only call one of them once.
      Specified by:
      answer in interface Question
      Parameters:
      answer - the Akiwrapper.Answer to submit.
      Returns:
      the next Query or null if there are none left.
      See Also:
    • undoAnswer

      public Question undoAnswer()
      Description copied from interface: Question
      This is an interaction method for Question.
      Goes one question backwards, undoing the previous Question.answer(Answer) call. For example, if Question.getQuestion() returns a question on step 5, calling this command will return the question on step 4. You can call this as many times as you want, until you reach step 0. Note that this will always return a Question, and never a Guess or null.
      Note: A single Question object can only be interacted with once. Calling Question.answer(Answer) or Question.undoAnswer() mutates the session state, so you can only call one of them once.
      Specified by:
      undoAnswer in interface Question
      Returns:
      the previous Question.
      See Also:
    • getText

      public String getText()
      Description copied from interface: Question
      Returns the question text that should be displayed to the user. This is localized to the Akiwrapper.Language and in line with the Akiwrapper.Theme set in the AkiwrapperBuilder.

      Example

      Is your character real?
      Specified by:
      getText in interface Question
      Returns:
      the question text.
    • getAkitude

      public URL getAkitude()
      Description copied from interface: Question
      URL to the akitude image. "Akitude" is likely a portmanteau of "Akinator" and "attitude", and they represent Akinator's current confidence - previously this was calculated using a formula on the step and progression values, now it's returned by the API. On the website, the akitude is shown on the left of the question box.

      Example

      https://en.akinator.com/assets/img/akitudes_670x1096/defi.png
      Specified by:
      getAkitude in interface Question
      Returns:
      the akitude image URL.