org.activemath.content
Class TocEntry

java.lang.Object
  extended by 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).


Field Summary
protected static Logger log
           
 
Constructor Summary
TocEntry(String id, String bookId, Map titles)
           
 
Method Summary
 void addChild(TocEntry child)
           
 Object clone()
          Make a deep copy
 String getBookId()
           
 TocEntry getById(String tocEntryId)
          Find a TocEntry by id, starting from root of this entry.
 List<TocEntry> getChildLeafs()
           
 int getChildNum()
           
 List<TocEntry> getChildren()
           
 String getDescription()
           
 String getDescription(String lang)
           
 String getDescription(String lang, String defaultLang)
           
 Map<String,String> getDescriptions()
           
 String getId()
           
 String getItemId()
           
 Map<String,Integer> getKnowledgeMap()
           
 List<TocEntry> getLeafsContained()
           
 List<TocEntry> getLeafSiblings()
           
 List<TocEntry> getLeafSiblingsAndMe()
           
 int getLevel()
           
 int getMastery()
           
 String getMbaseId()
           
 Metadata getMetadata()
           
 List<TocEntry> getModifiableChildrenList()
          Method needed by User-model inspector filters (e.g.
 TocEntry getNext()
           
 int getNumItems()
           
 int getNumLeafsContained()
           
 Page getPage()
           
 String getPageId()
           
 TocEntry getParent()
           
 TocEntry getPrev()
           
 Progress getProgress()
           
 String getSectionNumber()
           
 String getTitle()
           
 String getTitle(String lang)
           
 String getTitle(String lang, String defaultLang)
           
 String getTitleAsText()
           
 List<String> getTitlePath()
           
 Map<String,String> getTitles()
           
 User getUser()
           
 boolean isLeaf()
           
 void removeChild(TocEntry child)
           
 void setDescription(String string)
           
 void setDescription(String lang, String title)
           
 void setId(String id)
           
 void setItemId(String id)
           
 void setKnowledgeMap(Map<String,Integer> knowledgeMap)
           
 void setLevel(int i)
           
 void setMastery(int i)
           
 void setMbaseId(String mbaseId)
           
 void setPageId(String pageId)
           
 void setParent(TocEntry parent)
           
 void setProgress(Progress progress)
           
 void setSectionNumber(String id)
           
 void setTitle(String string)
           
 void setTitle(String lang, String title)
           
 void setTitleAsText(String titleAsText)
           
 void setTitlePath(List<String> titlePath)
           
 void setUser(User user)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static Logger log
Constructor Detail

TocEntry

public TocEntry(String id,
                String bookId,
                Map titles)
Method Detail

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