Interface Question
- All Superinterfaces:
Query
- All Known Implementing Classes:
QuestionImpl
A type of
Note: A single
Query that represents Akinator's question. Questions are
answered with answer(Answer) (incrementing the step or undone
with undoAnswer() (decrementing the step). Besides the question
text, questions also come with an "akitude" picture, a portmanteau of "Akinator"
and "attitude", which can be shown to the user.Note: A single
Question object can only be interacted with once.
Calling answer(Answer) or undoAnswer() mutates the session
state, so you can only call one of them once.- Author:
- Marko Zajc
-
Method Summary
Modifier and TypeMethodDescriptionanswer(Akiwrapper.Answer answer) URL to the akitude image.default StringDeprecated, for removal: This API element is subject to removal in a future version.getText()Returns the question text that should be displayed to the user.This is an interaction method forQuestion.
Goes one question backwards, undoing the previousanswer(Answer)call.Methods inherited from interface org.eu.zajc.akiwrapper.core.entities.Query
getAkiwrapper, getProgression, getStep
-
Method Details
-
answer
This is an interaction method forQuestion.
Submits an answer for the question and returns the nextQuery, incrementing the current step.
If there are no more questions left, this will returnnull.
Note: A singleQuestionobject can only be interacted with once. Callinganswer(Answer)orundoAnswer()mutates the session state, so you can only call one of them once.- Parameters:
answer- theAkiwrapper.Answerto submit.- Returns:
- the next
Queryornullif there are none left. - Throws:
IllegalStateException- if thisQuestionis not the same asAkiwrapper.getCurrentQuery(), which happens if you attempt to interact with it twice.ServerStatusException- if the API server returns an erroneousObjectInputFilter.Status.AkinatorException- if something else goes wrong during the API call.- See Also:
-
undoAnswer
This is an interaction method forQuestion.
Goes one question backwards, undoing the previousanswer(Answer)call. For example, ifgetQuestion()returns a question on step5, calling this command will return the question on step4. You can call this as many times as you want, until you reach step0. Note that this will always return aQuestion, and never aGuessornull.
Note: A singleQuestionobject can only be interacted with once. Callinganswer(Answer)orundoAnswer()mutates the session state, so you can only call one of them once.- Returns:
- the previous
Question. - Throws:
UndoOutOfBoundsException- if the session has exhausted all questions (whengetQuestion()returnsnull.IllegalStateException- if thisQuestionis not the same asAkiwrapper.getCurrentQuery(), which happens if you attempt to interact with it twice.ServerStatusException- if the API server returns an erroneousObjectInputFilter.Status.AkinatorException- if something else goes wrong during the API call.- See Also:
-
getText
Returns the question text that should be displayed to the user. This is localized to theAkiwrapper.Languageand in line with theAkiwrapper.Themeset in theAkiwrapperBuilder.Example
Is your character real?- Returns:
- the question text.
-
getQuestion
Deprecated, for removal: This API element is subject to removal in a future version.usegetText()instead.Returns the question text that should be displayed to the user. This is localized to theAkiwrapper.Languageand in line with theAkiwrapper.Themeset in theAkiwrapperBuilder.Example
Is your character real?- Returns:
- the question text.
-
getAkitude
URL getAkitude()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- Returns:
- the akitude image URL.
-
getText()instead.