org.activemath.content
Class TocEntry
java.lang.Object
org.activemath.content.TocEntry
- All Implemented Interfaces:
- Cloneable
public class TocEntry
- extends Object
- implements Cloneable
Content abstraction of a TOC entry.
Part of a tree structure starting from TOC).
log
protected static Logger log
TocEntry
public TocEntry(String id,
String bookId,
Map titles)
addChild
public void addChild(TocEntry child)
removeChild
public void removeChild(TocEntry child)
getChildNum
public int getChildNum()
- Returns:
- position in parent's child list
setParent
public void setParent(TocEntry parent)
getParent
public TocEntry getParent()
- Returns:
- parent entry, or
null.
getLeafSiblings
public List<TocEntry> getLeafSiblings()
- Returns:
- all siblings that are leafs, excluding myself.
getLeafSiblingsAndMe
public List<TocEntry> getLeafSiblingsAndMe()
- Returns:
- all siblings that are leafs, including myself.
getNext
public TocEntry getNext()
- Returns:
- next sibling, or
null.
getPrev
public TocEntry getPrev()
- Returns:
- previous sibling, or
null.
setId
public void setId(String id)
getId
public String getId()
setSectionNumber
public void setSectionNumber(String id)
getSectionNumber
public String getSectionNumber()
getMbaseId
public String getMbaseId()
setMbaseId
public void setMbaseId(String mbaseId)
setTitle
public void setTitle(String string)
getTitles
public Map<String,String> getTitles()
getTitle
public String getTitle()
getTitle
public String getTitle(String lang)
setTitle
public void setTitle(String lang,
String title)
getTitle
public String getTitle(String lang,
String defaultLang)
getTitlePath
public List<String> getTitlePath()
- Returns:
- a list containing the localized titles of all parents,
excluding the top parent (highest parent first)
setTitlePath
public void setTitlePath(List<String> titlePath)
getTitleAsText
public String getTitleAsText()
setTitleAsText
public void setTitleAsText(String titleAsText)
getDescriptions
public Map<String,String> getDescriptions()
- Returns:
- a map containing the description. Empty map if no description was
defined.
setDescription
public void setDescription(String string)
getDescription
public String getDescription()
getDescription
public String getDescription(String lang)
setDescription
public void setDescription(String lang,
String title)
getDescription
public String getDescription(String lang,
String defaultLang)
getBookId
public String getBookId()
getChildren
public List<TocEntry> getChildren()
getModifiableChildrenList
public List<TocEntry> getModifiableChildrenList()
- Method needed by User-model inspector filters (e.g. OmdocTypeFilter) as they work on a live
clone of the TOC for prerecorded books (see bug AMATH-56).
- Returns:
- the List of this TocEntry's children.
getChildLeafs
public List<TocEntry> getChildLeafs()
- Returns:
- list of direct children that are leafs.
getLeafsContained
public List<TocEntry> getLeafsContained()
- Returns:
- list of contained TocEntries that are leafs
getNumLeafsContained
public int getNumLeafsContained()
isLeaf
public boolean isLeaf()
getNumItems
public int getNumItems()
- Returns:
- number of items in contained leafs
getMastery
public int getMastery()
- Returns:
- mastery of page (for toc leafs), or average mastery over all children
setMastery
public void setMastery(int i)
setItemId
public void setItemId(String id)
getItemId
public String getItemId()
- Returns:
- for chapters: mbaseId of associated item
getMetadata
public Metadata getMetadata()
- Returns:
- Metadata of associated Item, or
null.
getLevel
public int getLevel()
setLevel
public void setLevel(int i)
getPageId
public String getPageId()
setPageId
public void setPageId(String pageId)
getPage
public Page getPage()
setUser
public void setUser(User user)
getUser
public User getUser()
- Returns:
- user object this toc entry is personalized to, or
null.
getKnowledgeMap
public Map<String,Integer> getKnowledgeMap()
setKnowledgeMap
public void setKnowledgeMap(Map<String,Integer> knowledgeMap)
getProgress
public Progress getProgress()
setProgress
public void setProgress(Progress progress)
getById
public TocEntry getById(String tocEntryId)
- Find a TocEntry by id, starting from root of this entry.
- Parameters:
tocEntryId - - absolute path to child
- Returns:
- TocEntry described by path, or
null.
clone
public Object clone()
throws CloneNotSupportedException
- Make a deep copy
- Overrides:
clone in class Object
- Throws:
CloneNotSupportedException
toString
public String toString()
- Overrides:
toString in class Object