开发者

Java: linked lists of lines for viewing source?

Trying to understand this documentation:

from http://otndnld.oracle.co.jp/document/products/workshop/docs81/doc/ja_JP/workshop/java-class/com/bea/ide/sourceeditor/model/ISourceModel.html

is the 'linked list of lines' being used as the UI for the source view?

"public interface ISourceModel

A source model is a data structure that contains the actual text data of a given document. Generally implemented as a linked list of lines, some implementations开发者_运维问答 may extend the swing AbstractDocument class, though this is not required and should not be relied upon."


No, as the name of the class hints, this is used as the Model for the editor (the data that will be displayed).

In this case, I understand the view is a text editor, so it makes sense that the data is a series of line of text.

Following the Model-View-Controller pattern, another class (probably a SourceView or something) would be responsible for displaying the lines.


Not the UI, but the data model itself. Instead of holding the text as one enormous String, the data is held as many Strings, one for each line, held in an ordered collection. This is obviously a better data structure for many operations; it would require a lot less searching to find various text features.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜