In this project, you will be developing a simple Java application (txted) using an agile, test-driven process involving multiple deliverables. While you will receive one grade for the entire project, each deliverable must be completed by its own due date, and all deliverables will contribute to the overall project grade.
Speciﬁcation of the txted Utility
txted is a simple command-line utility written in Java with the following speciﬁcation:
txted allows for simple text manipulation of the content of a ﬁle.
txted OPTIONS FILE
Program txted performs basic text transformations on lines of text from an input
FILE. Unless the -f option (see below) is speciﬁed, the program writes transformed text to stdout and errors/usage messages to stderr. The FILE parameter is required and must be the last parameter. OPTIONS may be zero or more of the following and may occur in any order:
Edit ﬁle in place. The program overwrites the input ﬁle with transformed text instead of writing to stdout.
● -e <string>
Exclude any lines containing the given string.
Used with the -e ﬂag ONLY; applies case insensitive matching.
● -s <integer>
● Skip either the even or odd lines in a ﬁle, with 0 being even and 1 being odd.
● -x <string>
Adds string as a suﬃx to each line.
Reverse the order of lines in a ﬁle — the last line is ﬁrst, the ﬁrst line is last, and so on.
● -n <integer>
Add a line number ﬁeld followed by a single space to the beginning of each line output. The line number ﬁeld shall be left-padded with 0 or left-truncated as required to the width speciﬁed by the integer parameter.
Line numbering should start at 1.
● While the last command-line parameter provided is always treated as the ﬁlename, OPTIONS ﬂags can be provided in any order and will be applied as follows:
○ Options -f and -i should be processed ﬁrst, as they determine global parameters of the computation.
○ Options -s, -e, -x, -r, and -n should be processed in this order. That is: (1) if -s is present, then ﬁle content is ﬁltered based on the speciﬁed parameter; (2) if -e is present, then ﬁle content excludes lines that include the speciﬁed parameter; (3) if -x is present, then a suﬃx should be applied; (4) if -r is present, then reversal of line order logic is performed; (5) if -n is present, then padded line numbering should be applied.
● Specifying option -i without having speciﬁed option -e should result in an error.
● Specifying option -e or -x with an empty string parameter should result in an error.
● Specifying option -n with an integer <0 should result in an error.
● Specifying option -s with an input parameter not equal to 0 or 1 should result in an error. Each ﬁle starts with line 1, which should be considered odd.
● If options are repeated, only their last occurrence is considered.
● All program option parameters are required and will result in an error if omitted.
● You should assume that the <string> parameters will not contain newlines, as the behavior of the program is platform dependent and undeﬁned in those cases.
● You should assume that the last line of the input ﬁle will be newline-terminated. Otherwise, program behavior is undeﬁned.
○ The only exception would be an empty input ﬁle which should produce an empty output with no options executed.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: firstname.lastname@example.org 微信:itcsdx