You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
FYReader/app/src/main/java/xyz/fycz/myreader/util/FileStack.java

49 lines
1022 B

package xyz.fycz.myreader.util;
import java.io.File;
import java.util.List;
/**
* Created by newbiechen on 17-5-28.
*/
public class FileStack {
private Node node = null;
private int count = 0;
public void push(FileSnapshot fileSnapshot){
if (fileSnapshot == null) return;
Node fileNode = new Node();
fileNode.fileSnapshot = fileSnapshot;
fileNode.next = node;
node = fileNode;
++count;
}
public FileSnapshot pop(){
Node fileNode = node;
if (fileNode == null) return null;
FileSnapshot fileSnapshot = fileNode.fileSnapshot;
node = fileNode.next;
--count;
return fileSnapshot;
}
public int getSize(){
return count;
}
//节点
public class Node {
FileSnapshot fileSnapshot;
Node next;
}
//文件快照
public static class FileSnapshot{
public String filePath;
public List<File> files;
public int scrollOffset;
}
}