Microsoft Word OpenIssuesInOO. doc

  Part pattern  versus pattern reference

Download 1.28 Mb.
Pdf ko'rish
Hajmi1.28 Mb.
1   ...   13   14   15   16   17   18   19   20   ...   51
4.1.2.  Part pattern  versus pattern reference 

A part pattern is a pattern that is physically part of an object. This corresponds to textually 

nesting of procedures and classes and is often called block-structure.  It is well known from 

mainstream object-oriented languages that the attributes of an object may be 

procedures/methods, but classes as  attributes are quite uncommon. In BETA class nesting 

may be used as in the following example: 



(#  content: @text; pos: @integer; 



new: ...; open: ...; close: ...; 












cut: (#do (first,last)->content.delete #);  





copy: (#exit (first,last)->content.copy #); 


















D1,D2: @Document;  

S1,S2: @D1.Selection;  

S3,S4: @D2.Selection 

A document-object consists of a content that is a text. A variable pos contains the current 

(cursor) position in the document. A document has operations new, open and close. In 

addition a document object has a class pattern attribute Selection that is an object 

representing a selection in the document. A selection is characterised by an interval in the 

content, represented by the integers first and last.  A selection has three operations

cut, copy and paste. Cut deletes the selection from content, copy returns a copy of the 

selection and paste copy the selection into a destination document. 

Since Selection is a pattern declared textually within Document, each instance of 

Document has its own Selection class. The documents D1 and D2 thus each has a 

class D1.Selection and D2.Selection that are in fact different classes. The objects 

S1 and S2 are instances of D1.Selection  and  S2,  S3 are instances of 


Since  Selection is part of a Document object, it is possible from a Selection 

object refer to variables and operations in the enclosing Document object. For example 

S1.cut will execute the operation 


where content will refer to the content variable in the enclosing D1 document.  

Textual nesting of classes is a common used feature in most of the Mjølner BETA 

libraries and application frameworks. The above example is a simplified example of how 

components (like class document) and anchors (like class Selection) are represented in the 

DEVISE hypermedia framework [GT94] . 

Part patterns/nested patterns are similar to part objects in the sense that they are a fixed 

part of an object. Like it is possible to have references to objects, it is also possible to have 

references to patterns. Such references are closures in the sense that they refer patterns and 

their textual enclosing scope. For a description of pattern references in BETA, see 

Reference [MMN93]. 

Download 1.28 Mb.

Do'stlaringiz bilan baham:
1   ...   13   14   15   16   17   18   19   20   ...   51

Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan © 2020
ma'muriyatiga murojaat qiling

    Bosh sahifa
davlat universiteti
ta’lim vazirligi
maxsus ta’lim
O’zbekiston respublikasi
zbekiston respublikasi
axborot texnologiyalari
o’rta maxsus
nomidagi toshkent
guruh talabasi
davlat pedagogika
texnologiyalari universiteti
xorazmiy nomidagi
toshkent axborot
pedagogika instituti
rivojlantirish vazirligi
haqida tushuncha
toshkent davlat
Toshkent davlat
vazirligi toshkent
tashkil etish
matematika fakulteti
ta’limi vazirligi
kommunikatsiyalarini rivojlantirish
samarqand davlat
vazirligi muhammad
pedagogika universiteti
bilan ishlash
fanining predmeti
Darsning maqsadi
navoiy nomidagi
o’rta ta’lim
Ishdan maqsad
haqida umumiy
nomidagi samarqand
fizika matematika
sinflar uchun
fanlar fakulteti
maxsus ta'lim
Nizomiy nomidagi
ta'lim vazirligi
moliya instituti
universiteti fizika
Ўзбекистон республикаси
umumiy o’rta
Referat mavzu
respublikasi axborot
Toshkent axborot
таълим вазирлиги
Alisher navoiy
махсус таълим
Buxoro davlat