Review of hw j3
This presentation is the property of its rightful owner.
Sponsored Links
1 / 10

Review of HW J3 PowerPoint PPT Presentation


  • 58 Views
  • Uploaded on
  • Presentation posted in: General

Review of HW J3. Aaron Bloomfield CS 101-E. Strand. Strand. String. - nucleotideSequence =. - nucleotideSequence =. text = “tgccagt” - length = 7. Strand. + public Strand() + public Strand(String s) + public Object clone() + public String toString()

Download Presentation

Review of HW J3

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Review of hw j3

Review of HW J3

Aaron Bloomfield

CS 101-E


Strand representation

Strand

Strand

String

- nucleotideSequence =

- nucleotideSequence =

  • text = “tgccagt”

  • - length = 7

Strand

+public Strand()

+public Strand(String s)

+ public Object clone()

+public String toString()

+public void splice(Strand otherStrand)

+public Strand slice(int i1, int i2)

+public int has(Strand s)

+public Strand substrand(int i1)

+public Strand substrand(int i1, int i2)

+public Strand()

+public Strand(String s)

+ public Object clone()

+public String toString()

+public void splice(Strand otherStrand)

+public Strand slice(int i1, int i2)

+public int has(Strand s)

+public Strand substrand(int i1)

+public Strand substrand(int i1, int i2)

+ length (): int

+ charAt (int i): char

+ subString (int m, int n): String

+ indexOf (String s, int m): int

+ ...

- nucleotideSequence =

+ public Strand slice(int i1, int i2)

+…

“tgccagt”

Strand representation


Void splice strand otherstrand

splice (…)

trailing

leading

“0123456789”

this

Strand

Strand

- nucleotideSequence =

- nucleotideSequence =

Strand

+ public void splice (Strand otherStrand)

+…

+ public void splice (Strand otherStrand)

+…

- nucleotideSequence =

otherStrand

+ public void splice ( )

+…

“6789”

“012345”

void splice (Strand otherStrand)

public void splice(Strand otherStrand) {

// determine the concatenation components

String leading = this.nucleotideSequence;

String trailing = otherStrand.nucleotideSequence;

// update strand to be a concatenation

this.nucleotideSequence = leading + trailing;

}

public void splice(Strand otherStrand) {

// determine the concatenation components

String leading = this.nucleotideSequence;

String trailing = otherStrand.nucleotideSequence;

// update strand to be a concatenation

this.nucleotideSequence = leading + trailing;

}

public void splice(Strand otherStrand) {

// determine the concatenation components

String leading = this.nucleotideSequence;

String trailing = otherStrand.nucleotideSequence;

// update strand to be a concatenation

this.nucleotideSequence = leading + trailing;

}

public void splice(Strand otherStrand) {

// determine the concatenation components

String leading = this.nucleotideSequence;

String trailing = otherStrand.nucleotideSequence;

// update strand to be a concatenation

this.nucleotideSequence = leading + trailing;

}

public void splice(Strand otherStrand) {

// determine the concatenation components

String leading = this.nucleotideSequence;

String trailing = otherStrand.nucleotideSequence;

// update strand to be a concatenation

this.nucleotideSequence = leading + trailing;

}

public void splice(Strand otherStrand) {

// determine the concatenation components

String leading = nucleotideSequence;

String trailing = otherStrand.nucleotideSequence;

// update strand to be a concatenation

nucleotideSequence = leading + trailing;

}

Not an

member variable!!!

Not required!


Public strand

this

Strand

- nucleotideSequence =

+ public Strand ()

+…

“”

public Strand ()

// Strand(): default constructor

public Strand() {

this.nucleotideSequence = "";

}


Public strand string s

Strand

- nucleotideSequence =

this

desiredSequence

+ public Strand ( )

+…

Strand

- nucleotideSequence =

+ public Strand (String desiredSequence)

+ …

“012345”

public Strand (String s)

// Strand(): specific constructor

public Strand(String desiredSequence) {

this.nucleotideSequence = desiredSequence;

}


Public strand slice int i1 int i2

this

String

  • text = “0123456789”

  • - …

Strand

Strand

Strand

+ subString (int m, int n): String

+ subString (int m): String

+ ...

result

- nucleotideSequence =

- nucleotideSequence =

- nucleotideSequence =

(prefix+suffix)

+ public Strand slice (int i1, int i2)

+…

+ public Strand slice (int i1, int i2)

+…

+ public Strand slice (4,7)

+…

prefix

middle

suffix

“01237890”

“01237890”

“7890”

“456”

“0123”

public Strand slice (int i1, int i2)

method returns:

String middle =

this.nucleotideSequence.substring(i1, i2);

String prefix =

this.nucleotideSequence.substring(0, i1);

String suffix =

this.nucleotideSequence.substring(i2);

this.nucleotideSequence = prefix + suffix;

Strand result = new Strand(middle);

return result;


Public strand slice int i1 int i21

public Strand slice (int i1, int i2)

// slice(): extract portion of the Strand with indices i1 - i2-1

public Strand slice(int i1, int i2) {

// decompose the nucleotide sequence into three parts

String prefix = this.nucleotideSequence.substring(0, i1);

String middle = this.nucleotideSequence.substring(i1, i2);

String suffix = this.nucleotideSequence.substring(i2);

// update strand to be concatenation of prefix and suffix

this.nucleotideSequence = prefix + suffix;

// return the extracted strand

Strand result = new Strand(middle);

return result;

}


Public int has strand s

this

String

  • text = “0123456789”

  • - …

Strand

Strand

Strand

+ indexOf (String s): int

+ ...

- nucleotideSequence =

- nucleotideSequence =

- nucleotideSequence =

+ Strand has (Strand otherStrand): int

+…

+ public Strand has ( ): int

+…

+ public Strand has (Strand s): int

+…

otherSequence

otherStrand

“5678”

public int has (Strand s)

public int has(Strand otherStrand) {

String otherSequence =

otherStrand.nucleotideSequence;

int result = this.nucleotideSequence.

indexOf.(otherSequence);

return result;

}


Public strand substrand int i1 int i2

this

String

  • text = “0123456789”

  • - …

Strand

Strand

Strand

+ substring (int i1, int i2): String

+ ...

result

- nucleotideSequence =

- nucleotideSequence =

- nucleotideSequence =

middle

+ public Strand substrand (int i1, int i2)

+ …

+ public Strand substrand (2,6)

+ …

+ public Strand substrand (int i1, int i2)

+ …

“2345”

public Strand substrand (int i1, int i2)

public Strand substrand (int i1, int i2) {

String middle = this.nucleotideSequence.

substring(i1, i2);

Strand result = new Strand (middle);

return result;

}


Public strand substrand int i1

public Strand substrand (int i1)

public Strand substrand (int i) {

return this.substrand (i, i + 1);

}


  • Login