Many encoded strings contain delimiters. A delimiter is a non-empty string that acts as a boundary between different parts of a larger string. The delimiters involved in this question occur in pairs that must be balanced, with each pair having an open delimiter and a close delimiter. There will be only one type of delimiter for each string. The following are examples of delimiters. Example 1 Expressions in mathematics use open parentheses "(" and close parentheses ")" as delimiters. For each open parenthesis, there must be a matching close parenthesis. (x + y) * 5 is a valid mathematical expression. (x + (y) is NOT a valid mathematical expression because there are more open delimiters than close delimiters. HTML uses and as delimiters. For each open delimiter , there must be a matching close Example 2 delimiter . Make this text bold Make this text bold is valid HTML. is NOT valid HTML because there is one open delimiter and no matching close delimiter. In this question, you will write two methods in the following Delimiters class. public class Delimiters { /** The open and close delimiters. */ ; ; /** Constructs a Delimiters object where open is the open delimiter and close is the * close delimiter. * Precondition: open and close are non-empty strings. */ public Delimiters(String open, String close) { openDel = open; closeDel = close; private String openDel private String closeDel } /** Returns an ArrayList of delimiters from the array tokens, as described in part (a). */ public ArrayList getDelimitersList(String[] tokens) { /* to be implemented in part (a) */ } /** Returns true if the delimiters are balanced and false otherwise, as described in part (b). * Precondition: delimiters contains only valid open and close delimiters. */ public boolean isBalanced(ArrayList delimiters) { /* to be implemented in part (b) */ } // There may be instance variables, constructors, and methods that are not shown. }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Many encoded strings contain delimiters. A delimiter is a non-empty string that acts as a boundary between different parts of a larger string. The delimiters involved in this question occur in pairs that must be balanced, with each pair having an open delimiter and a close delimiter. There will be only one type of delimiter for each string. The following are examples of delimiters.
Example 1
Expressions in mathematics use open parentheses "(" and close parentheses ")" as delimiters. For each open parenthesis, there must be a matching close parenthesis.
(x + y) * 5 is a valid mathematical expression.
(x + (y) is NOT a valid mathematical expression because there are more open delimiters
than close delimiters.
HTML uses <B> and </B> as delimiters. For each open delimiter <B>, there must be a matching close
Example 2 delimiter </B>.
<B> Make this text bold </B>
<B> Make this text bold </UB>
is valid HTML.
is NOT valid HTML because there is one open delimiter and no matching close delimiter.

In this question, you will write two methods in the following Delimiters class. public class Delimiters
{
/** The open and close delimiters. */ ;
;
/** Constructs a Delimiters object where open is the open delimiter and close is the
* close delimiter.
* Precondition: open and close are non-empty strings. */
public Delimiters(String open, String close)
{
openDel = open;
closeDel = close;
private String openDel
private String closeDel
}
/** Returns an ArrayList of delimiters from the array tokens, as described in part (a). */ public ArrayList<String> getDelimitersList(String[] tokens)
{ /* to be implemented in part (a) */ }
/** Returns true if the delimiters are balanced and false otherwise, as described in part (b). * Precondition: delimiters contains only valid open and close delimiters.
*/
public boolean isBalanced(ArrayList<String> delimiters)
{ /* to be implemented in part (b) */ }
// There may be instance variables, constructors, and methods that are not shown. }

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Counting Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education