Skip to content

Commit

Permalink
inner class with sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
nglthu committed Mar 7, 2024
1 parent 6512977 commit 85b0511
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/mycompany/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

import com.mycompany.app.Animal.*;
import com.mycompany.app.Sequence.SequenceA;
import com.mycompany.app.Sequence.Selector;
import com.mycompany.app.Sequence.SelectorA;


import com.mycompany.app.Node.*;
Expand Down Expand Up @@ -176,7 +176,7 @@ public static void main(String[] args) {
for(int i=0; i<10; i++){
seq.add(Integer.toString(i));
}
Selector sl = seq.getSelector();
SelectorA sl = seq.getSelector();
while (!sl.end()){

System.out.println("sequence"+ sl.current());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.mycompany.app.Sequence;

public interface Selector {
public interface SelectorA {
boolean end();
Object current();
void next();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/mycompany/app/Sequence/SequenceA.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void add(Object x){
if(next<obj.length) {obj[next] = x; next ++;}
}
//inner class of Subsequence
private class SSelector implements Selector{
private class SSelector implements SelectorA{
int i = 0;

@Override
Expand All @@ -37,7 +37,7 @@ public void next() {
//end, current, next
}

public Selector getSelector(){
public SelectorA getSelector(){
return new SSelector();
}

Expand Down

0 comments on commit 85b0511

Please sign in to comment.