Question: package MyImplementations; / / Implementing the String class public class MyString { private char [ ] chars; / / Constructor from a char array public
package MyImplementations;
Implementing the String class
public class MyString
private char chars;
Constructor from a char array
public MyStringchar chars
this.chars new charcharslength;
for int i ; i chars.length; i
this.charsi charsi;
constructor from a String
public MyStringString s
thisstoCharArray;
constructor from a MyString
public MyStringMyString s
thisstoCharArray;
toCharArray
public char toCharArray
char result new charcharslength;
for int i ; i chars.length; i
resulti charsi;
return result;
toString
public String toString
return new Stringchars;
Returns the length of the string
public int length
WRITE YOUR CODE HERE
Returns the character at the specified index
public char charAtint index
WRITE YOUR CODE HERE
Returns a new MyString that is a substring of this MyString
public MyString substringint begin, int end
WRITE YOUR CODE HERE
Returns the MyString that is the concatenation of this MyString and the
specified MyString
public MyString concatMyString s
WRITE YOUR CODE HERE
Returns the MyString that is the concatenation of this MyString and the String
public MyString concatString s
WRITE YOUR CODE HERE
indexOf
public int indexOfMyString s
WRITE YOUR CODE HERE
indexOf
public int indexOfMyString s int fromIndex
WRITE YOUR CODE HERE
replace oldString with newString
public MyString replaceMyString oldString, MyString newString
WRITE YOUR CODE HERE
public MyString replaceString oldString, String newString
WRITE YOUR CODE HERE
public MyString replacechar oldChar, char newChar
WRITE YOUR CODE HERE
count
public int countMyString s
WRITE YOUR CODE HERE
count
public int countString s
WRITE YOUR CODE HERE
count
public int countchar c
WRITE YOUR CODE HERE
split
public MyString splitMyString regex
WRITE YOUR CODE HERE
split with String
public MyString splitString regex
return splitnew MyStringregex;
trim
public MyString trim
WRITE YOUR CODE HERE
toLowerCase
public MyString toLowerCase
WRITE YOUR CODE HERE
toUpperCase
public MyString toUpperCase
WRITE YOUR CODE HERE
equalsIgnoreCase
public boolean equalsIgnoreCaseMyString s
WRITE YOUR CODE HERE
compareTopublic int compareToMyString s
WRITE YOUR CODE HERE
compareToIgnoreCase
public int compareToIgnoreCaseMyString s
WRITE YOUR CODE HERE
startsWith
public boolean startsWithMyString s
WRITE YOUR CODE HERE
endsWith
public boolean endsWithMyString s
WRITE YOUR CODE HERE
contains
public boolean containsMyString s
WRITE YOUR CODE HERE
valueOf
public static MyString valueOfNumber i
WRITE YOUR CODE HERE
equals
public boolean equalsObject o
WRITE YOUR CODE HERE
equals for String
public boolean equalsString s
WRITE YOUR CODE HERE
equals MyString
public boolean equalsMyString s
WRITE YOUR CODE HERE
hashCode
public int hashCode
int h ;
for int i ; i length; i
h h charAti;
return h;
All wrapper code below this line
#region
startsWith String
public boolean startsWithString s
WRITE YOUR CODE HERE
endsWith String
public boolean endsWithString s
WRITE YOUR CODE HERE
contains String
public boolean containsString s
WRITE YOUR CODE HERE
indexOf String
public int indexOfString s
WRITE YOUR CODE HERE
indexOf String from index
public int indexOfString s int fromIndex
WRITE YOUR CODE HERE
#endregion
indexOf char
public int indexOfchar ch
WRITE YOUR CODE HERE
indexOf char from index
public int indexOfchar ch int fromIndex
WRITE YOUR CODE HERE
package Editor; import java.ioBufferedReader; import java.ioBufferedWriter; import java.ioIOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import MyImplementations.MyArrayList; import MyImplementations.MyStack; import MyImplementations.MyString; public class Editor int row; int col; MyArrayList text; the undo stack MyStack undoStack; the redo stack MyStack redoStack; Current file name MyString fileName; class EditorAction the row of the action int row; the column of the action int col; the text of the action MyString text; the length of the action int length; the action type ActionType type; enum ActionType insert action INSERT, delete action DELETE, replace action REPLACE public EditorString myFilename thisnew MyStringmyFilename;
i apologize it for being so confusing chegg woulnt allow to me to post google drive for it please implement all the classes without changing ANYTHING. again tysm hope its not too hard to understand
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
