Question

In: Computer Science

In order to achieve faster access to data, many I/O operations involve specific data structure class...

In order to achieve faster access to data, many I/O operations involve specific data structure class called "Buffer". Our goal in this question is to design a UML class diagram for a character buffer (an array of chars ) based on the following description. This particular buffer:

  1. has the name charBuffer
  2. has a definite size
  3. has an indicator whether it is empty or not
  4. has an indicator whether it is full or not
  5. has write to buffer operation
  6. has read from buffer operation
  7. has delete buffer operation
  8. has check for emptiness operation
  9. has check for fullness operation

Solutions

Expert Solution

UML class diagram for Buffer:

Buffer

- charBuffer : char*

- size : int

- empty : bool

- full : bool

+ writeToBuffer(buffer : char*) : void

+ readFromBuffer() : char*

+ deleteBuffer() : void

+ isEmpty() : bool

+ isFull() : bool

Buffer class has the following data members:

  • charBuffer : char* -  which is an array of characters to store the contents to the buffer
  • size : int - which contains the maximum size of the buffer (integer)
  • empty : bool - which is indicator if buffer is empty or not (boolean)
  • full : bool - which is an indicator if buffer is full or not (boolean)

Buffer class has the following functions:

  • writeToBuffer(buffer : char*) : void - write the contents of buffer to charBuffer
  • readFromBuffer() - char* - return the contents of charBuffer
  • deleteBuffer() : void - delete the contents of charBuffer
  • isEmpty() : bool - returns if Buffer is empty or not (returns empty data member)
  • isFull() : bool - returns if Buffer is full or not (returns full data member)

Related Solutions

Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU's...
Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU's execution load. (a) What does the CPU do to interface with the device to coordinate the transfer? (b) How does the CPU know when the memory operations are complete? (c) The CPU is allowed to execute other programs while the DMA controller is transferring data. Does DMA interfere with the execution of the other programs? If so, describe what form of interference are caused.
In order to access this course, attend this class as an on-line student, and participate in...
In order to access this course, attend this class as an on-line student, and participate in class discussions, you need to use a specific course management system. Answer the following questions about this system. 1. What is the name of the course management system? 2. Who created this system? 3. Other than your instructor, name three ways to get technical help with this product. 4. Other than class discussions, talk about one function of this product. Define its purpose and...
Many people think it’s faster to order at the drive-thru than to order inside at fast-food...
Many people think it’s faster to order at the drive-thru than to order inside at fast-food restaurants.  To find out, two students randomly selected 10 times over a 2-week period to visit a local Dunkin’ Donuts restaurant.  At each of these times, one student ordered an iced coffee at the drive-thru and the other student ordered an iced coffee at the counter inside.  The table shows the times, in seconds, that it took for each student to receive their iced coffee after the...
A general trend in the structure of many biomolecules is: A) that the order and bonding...
A general trend in the structure of many biomolecules is: A) that the order and bonding of monomers form the basis for the secondary and tertiary structure of the polymer. B) that they are all soluble in water independent of the size of the polymer. C) that each class of biomolecule can form either fibrous or globular conformations depending on the chemical conditions inside the cell. D) that each class of biomolecule forms one type of secondary structure independent of...
Discuss Rees’ Spillover Effect, and outline the specific assumptions he makes in order to achieve his...
Discuss Rees’ Spillover Effect, and outline the specific assumptions he makes in order to achieve his results. Use diagrams where necessary.
Specific: What do I want to achieve? What is required of me, and what are my...
Specific: What do I want to achieve? What is required of me, and what are my constraints? Measurable: How much money is needed? How will I knowI know if I am succeeding? Attainable: How can I do this? Is this consistent with my financial goals? Realistic: Am I willing and able to do this? Timely:  What is my target date? What short-term goals must be achieved along the way to achieve my longer term goals?
Consider a device driver that manages the I/O to a specific device. Multiple threads in the...
Consider a device driver that manages the I/O to a specific device. Multiple threads in the system need to read information from the device. The device can only support one I/O command at a time. Previous I/O commands must complete before a new one is issued. Assume the device can be read using a readDevice( what ) method. Write a read( what ) method to be called by any thread in the system that wants to read something from the...
1. i) The majority of machining operations involve tool shapes that are three dimensions, which refer...
1. i) The majority of machining operations involve tool shapes that are three dimensions, which refer to orthogonal and oblique cutting. Explain the mechanism of both cutting with an aid of diagram ii) The accompanying illustration shows a fixture that is to be machined from rectangular blank. Recommend the type of operations, sequence required and specify the machine tools that are needed. 2. As an engineer, propose and describe the most suitable joining process for joining beam for bridge and...
CS 209 Data Structure 5. Consider the Pair class covered in class: class Pair {    ...
CS 209 Data Structure 5. Consider the Pair class covered in class: class Pair {     public A first;     public B second;     public Pair(A a, B b)     {         first = a;         second = b;     }     public void setFirst(A a)     {         first = a;     }     public A getFirst()     {         return first;     }     public void setSecond(B b)     {         second = b;     }     public...
Identify and describe the (5) areas of I/O psychology. Please be specific and detailed in your...
Identify and describe the (5) areas of I/O psychology. Please be specific and detailed in your description.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT