Docstoc

LST Node

Document Sample
LST Node Powered By Docstoc
					                                    Logic Specification Template
     Student      James Kim                                                      Date          03/13/2009
     Program      CAT Node Class Cycle 1                                         Program #     1
     Instructor   Fredericks                                                     Language      Java

     Design              CAT Needs Statement
     References          SDS Node Description




     Parameters          Global variable String PUT: String has been assigned to this class.
                         Global variable int nodeNumber: Integer has been assigned to this class.
                         Global variable of int nodeCoverArray[]: Array has been assigned to this class.



     function decorateNode(String parsedString)
              initialize all variables
              while String has a next line
                         increment line index
              instantiate an instance of an array with line index length
              for i is 0, while i is less than array length, increment i
                         save line of code into array
              for i is 0, while i is less than array length, increment i
                         create whitespace variable
                         for j is 0, while j < array length and char at index is a whitespace, increment j
                                    whitespace is equal to itself and char at index
                         if line contains “import”
                                    while index < array length and line does not contain “public class”
                                              set block of code to line and increment
                                    call decorateBlock function to decorate this block of code and save that block
                                    into a returnString
                         else if code contains “public”
                                    while index < array length and line does not contain a supposed next node
                                              set block of code to line and increment
                                    call decorateBlock function to decorate this block of code and save that block
                                    into a returnString
                         else if there exists if, else, while, switch, try, catch
                                    create a counter and set it to 1
                                    while index < array length and counter is > 0
                                              if “{“ exists
                                                        increment counter
                                              else if “}” exists
                                                        decrement counter
                                              concatenate line of code to a block of code
                                    call decorateIF function and save return value to a returnString
                         else if there exists for
                                    create a counter and set it to 1
                                    while index < array length and counter is > 0
                                              if “{“ exists



Document1                                                                                              Page 1 of 3
                                                   increment counter
                                         else if “}” exists
                                                   decrement counter
                                         concatenate line of code to a block of code
                                call decorateFOR function and save return value to a returnString
                       else
                                 while index < array length and array at index is not a supposed node
                                          concatentate the line of code with a block of code
                                 call decorateBlock and store it into a returnString
              return the returnString

     function decorateIF
              initialize variables and add beginning tags
              while block of code has a next line
                        concatenate line to a temporary string
              add end tags
              increment node number
              return block of decorated code

     function decorateFOR
              initialize variables
              get initialize portion of for loop
              set beginning and end tags to initialize portion
              set beginning and end tags to for loop portion
              get increment portion of for loop
              while block of code has a next line
                         concatenate line to a temporary string
              if final line contains a “{“
                         add beginning tag then increment portion then end tag
                         increment node number
              add begin tag for next node
              add “{“
              add end tag for “}”
              increment node number
              return block of code




Document1                                                                                           Page 2 of 3
     Logic Specification Template Instructions
     Purpose               - To contain the pseudocode for a program, component, or system
                           - To enable precise and complete program implementation
                           - To facilitate thorough design and implementation reviews and inspections
     General               - Use this template to document the program’s detailed logic.
                           - After implementation and testing, update the template to reflect the actual
                             implemented product.
                           - During detailed design, write the pseudocode needed to describe all of the
                             program’s logic.
                           - Use plain language and avoid using programming instructions wherever
                             practical.
     Header                - Enter your name and the date.
                           - Enter the program name and number.
                           - Enter the instructor’s name and the programming language you are using.
     Design References     List the references used to produce the program’s logical design.
                           - the Operational, Functional, and State templates
                           - the program’s requirements
                           - any other pertinent source
     Parameters            - Where needed, define any parameters or abbreviations used.
                           - Avoid duplicating definitions on other templates and reference these other
                             definitions where they are needed.




Document1                                                                                    Page 3 of 3

				
DOCUMENT INFO
Categories:
Tags:
Stats:
views:13
posted:8/1/2012
language:
pages:3