Class Choice
java.lang.Object
com.yahoo.component.provider.FreezableClass
com.yahoo.search.pagetemplates.model.AbstractChoice
com.yahoo.search.pagetemplates.model.Choice
- All Implemented Interfaces:
com.yahoo.component.provider.Freezable,PageElement
A choice between some alternative lists of page elements.
- Author:
- bratseth
-
Constructor Summary
ConstructorsConstructorDescriptionChoice()Creates an empty choiceChoice(List<List<PageElement>> alternatives) Creates a choice between some alternatives. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(PageTemplateVisitor visitor) Accepts a visitor to this structurevoidadd(List<PageElement> alternative) Convenience shorthand forif (alternative!Returns the alternatives of this as a live reference to the alternatives of this.static ChoicecreateSingleton(PageElement singletonAlternative) Creates a choice having a single alternative having a single page elementstatic ChoicecreateSingletons(List<PageElement> alternatives) Creates a choice in which each alternative consists of a single elementvoidfreeze()get(int index) Convenience shorthand ofreturn alternatives().get(index)booleanisChoiceBetween(Class pageTemplateModelElementClass) Answers true if this is either a choice between the given class, or between Lists of the given classbooleanisEmpty()Returns true only if there are no alternatives in thistoString()Methods inherited from class com.yahoo.search.pagetemplates.model.AbstractChoice
getMethod, setMethodMethods inherited from class com.yahoo.component.provider.FreezableClass
clone, ensureNotFrozen, isFrozenMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.yahoo.component.provider.Freezable
isFrozen
-
Constructor Details
-
Choice
public Choice()Creates an empty choice -
Choice
Creates a choice between some alternatives. This method takes a copy of the given lists.
-
-
Method Details
-
createSingleton
Creates a choice having a single alternative having a single page element -
createSingletons
Creates a choice in which each alternative consists of a single element -
alternatives
Returns the alternatives of this as a live reference to the alternatives of this. The list and elements may be modified unless this is frozen. This is never null. -
get
Convenience shorthand ofreturn alternatives().get(index) -
add
Convenience shorthand forif (alternative!=null) alternatives().add(alternative) -
isEmpty
public boolean isEmpty()Returns true only if there are no alternatives in this -
isChoiceBetween
Answers true if this is either a choice between the given class, or between Lists of the given class- Specified by:
isChoiceBetweenin classAbstractChoice
-
freeze
public void freeze()- Specified by:
freezein interfacecom.yahoo.component.provider.Freezable- Overrides:
freezein classcom.yahoo.component.provider.FreezableClass
-
accept
Accepts a visitor to this structure -
toString
-