Download presentation
Presentation is loading. Please wait.
Published byPhebe Gibbs Modified over 8 years ago
1
Keyword In Context Presented by Team 2 Francisco Soria Zhiyu Zhang Xuheng Xu Irene Peysakhov
2
KWIC General Assumptions I-Invocation Unix or DOS prompt II-Input More than one files Line are specified in each file III-Processing Lines are shifted Shifted lines are alphabetized IV-Output- Processed lines are outputted to stdout.
3
Object Oriented(OO) Style Object Oriented Style Overview: Consists of five components: Input, LineStorage, Circular Shift, Alphabetizer, Output Each component supports design decision and information hiding Data is accessed through module interfaces.
4
Main design decisions hidden by by each class: Input: Source of input LineStorage: Data Structure and algorithm to store lines. Circular Shift: Rules and method of shifting lines Alphabetizer: Rule and methods to alphabetize lines. Output- Direction (ie terminal/printer), and method used to output lines. Object Oriented(OO) Style
5
+ String[] getStr() + setup() + Alphabetizer() + sort(String[]) + String[] eliminator(String[]) Alphabetize - int counter; - static String sortedlines[]; LineStorage - String input; - String lines[]; static char charline[][]; - int line_num; + int numWords(int) + setchar() CircularShift - String input; -char charline[][]; static char circularshiftedlines[][]; - int line_no; - int line_no2=0; - int word[][]; + setup() + cs_setchar() + char cs_Char(int, int) + int cs_Word(int) Object Oriented(OO) Style - String[] filenames - String str Input + Input(String [] ) + readStr () + String getStr() Output - String[] prtdata; + print()
6
Output KWIC_OO main() Input Uses CircularShift csGetChar LineStorage getChar getNumWords getString Alphabetize getStr() Calls Object Oriented(OO) Style
7
Future change and its effect on modules in Object Oriented Style Future Change in KWIC1 (Main)InputLine StorageCircular ShiftAlphabetizerOutput Input SourceNoYesNo Output DestinationNo Yes Line DelimiterNoYesNo Word DelimiterNo YesNo Storage Data StructureNo YesNo Circular Shift AlgorithmNo YesNo Sort AlgorithmNo YesNo Addition of Module between Shift and SortYesNo YesNo Deletion of AlphabetizerYesNo Yes
8
Advantages: Easily changeable as a result of information hiding and separation of concerns between modules Good reusability of modules Disadvantages: Costly data storage Complex design for a simple system Object Oriented(OO) Style
9
Pipe and Filter Style Pipe and Filter Style Overview: Five Components: Input, Line Storage, CircularShift, Alphabetize and Output. Each Components represents a filter. The output of one filter is input of another, with exception of Input and Output filter. Input filter only gets its data from main function. The result of Output filter only goes to user’s terminal.
10
Pipe and Filter Style Input -char line_delimiter -String raw_data +Input(String[]) +ReadData(String) +String GetData() LineStorage -char line_delimiter -Vector lines +LineStorage(String) +setchar(String) +Vector GetData() CircularShift -Vector vcslines -char[] word_delimiter -int[] word_perline -int num_of_lines +CircularShift(Vector) +cs_setup(Vector) +cs_shift(Vector) +String cs_firstwordlast(String) +Vector GetData() Alphabetize -Vector Sortedlines +Alphabetize(Vector) - sort(Vector) +Vector GetData() Output +print(Vector)
11
Pipe and Filter Style Filter Data for Input Line Storage Circular Shift AlphabetizeOutput
12
Pipe and Filter Style KWIC_PIPE Input GetData Input LineStorage GetData LineStorage CircularShift GetData CircularShift Alphabetize GetData Alphabetize Output print main LineStorage CircularShiftAlphabetizeOutput Input senddata Input senddata LineStorage senddata CircularShift senddata Alphabetize print Uses
13
Pipe and Filter Style Future change and its effect on modules in Pipe and Filter Style Future Change in KWIC1 (Main)InputLine StorageCircular ShiftAlphabetizerOutput Input SourceYes No Output DestinationNo Yes Line DelimiterNoYes No Word DelimiterNo Yes No Storage Data StructureNo Yes Circular Shift AlgorithmNo YesNo Sort AlgorithmNo YesNo Addition of Filter between Shift and SortYes No change is required, if the new filter can accept and produce data in right format Deletion of Alphebetize FilterYesNo
14
Pipe and Filter Style Constraints: Filter/Module Constraints: Format of data passed from filter to another will has to be recognized by both filters. Hardware Constraints: If this system were going to be used for a very large data set, extension of memory in the computer hardware will be required.
15
Pipe and Filter Style Advantage: Supports intuitive flow of processing, therefore ease of comprehension Supports reuse, since each filter can function in isolation by providing data in the form it expects New filter can be easily added in the process as long as it has the ability to process the Output of its upstream filter and produce data in the form that downstream filter is expected.
16
Pipe and Filter Style Disadvantage: Difficult to change when data format is changed between filters. Upstream and downstream filters may need to be modified, if a filter is removed. Does not support the concept of information hiding.
17
Implicit Invocation Style Overview: Pattern: Input Implicitly Invoke next event Next event etc. Consists of six components: EventHandler, Input, LineStorage, CircularShift, Alphabetizer, and Output Input, LineStorage, CircularShift, Alphabetizer and Output are inherited from the Service class Abstract Data Access in contrast to pipeline Implicit Invocation Style
18
Input static string[] filenames static String str static char line_delimiter + char getLinedelimiter() + serve() + readStr() + Input () + Input(EventHandler) Implicit Invocation Style LineStorage -String input -String lines[] static char line_delimiter staticchar[] word_delimiter - int num_of_lines static Char charline[][] + char Char(int, int) + getLineNumber() + int num_of_words(int) + serve() + char[] getWorddelimiter() + LineStorage() + LineStorage(EventHandler)
19
CircularShift -String input -char charline[][] static char circularshiftedlines[][] -char charline[][] -int num_of_lines -int num_of_words -Char charline2[][] -int num_oflines2 + CircularShift() +CircularShift(EventHandler) + setup() + int getLineNumber() +serve() + char cs_Char(int, int) - cs_setchar() + int cs_Word(int) Implicit Invocation Style
20
Alphabetizer static int counter static sortedlines[] + setup() + serve() + Alphabetizer() - sort(String[] ) +String getString() + alphabetizer() Implicit Invocation Style Output -string[] prtdata + Output() + serve() +Output(EventHandler) + setup() +print()
21
EventHandler -Vector events - Vector services + Register(String) + sendEvent(String) Implicit Invocation Style Service -String regEvent -String rasEvent -EventHandler eh + Service() +Service(EventHandler) +abstract void serve()
22
MasterControl Input Output EventHandler CircularShift Alphabetizer LineStorage 1 2 34 5 Implicit Invocation Style 1,2,3,4,5 Represent the order of event Send the Event to EventHandler Implicitly invoke
23
CircularShift Alphabetizer LineStorage EventHandler MasterControl Output Input Send Event to sendEvent() Implicit Invocation Style
24
EventHandler Input LineStorage CircularShift Alphabetizer Output Invokes through Serve () Serve() Implicit Invocation Style
25
Service Input LineStorage CircularShift Alphabetizer Output Inheritance Implicit Invocation Style
26
Output KWIC_OO main() CircularShift char csGetChar LineStorage char getChar int getNumWords Input String getString Alphabetize String [] getStr() Calls Invokes KWIC
27
Implicit Invocation Style
28
Constraints Computations are invoked implicitly Requires modules be invoked in the correct order Requires support of event handling Implicit Invocation Style
29
Advantages Supports reusability because module only relies on existence of trigger event. Easier system evolution Supports abstract data representation Disadvantages Low performance No guarantee Implicit Invocation Style
30
Exception handling: Inappropriate invocation to KWIC system Input file does not exist Input file is empty Expected service is not registered for specific event. (Implicit Invocation) Keyword In Context
31
Summary
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.