id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
b5247299-25ac-4a52-92e3-2a39a44d1fe7 | public int getTotalWeight() {
return this.totalWeight;
} |
664c9248-046f-4761-a752-5c216cdd33b8 | public char getWeightedRandomLinkToken() {
int index = randomNumberGenerator.nextInt(getTotalWeight());
int cumulativeWeight = 0;
int i = 0;
do {
cumulativeWeight += this.links.get(i).getCount();
i++;
} while ((cumulativeWeight - 1) < index);
return links.get(i - 1).getToken();
} |
63cb1668-c72a-48fb-94ef-9c07fa8f0ff1 | public void recordLink(char token) {
if (findLink(token) == null) {
this.links.add(new Link(token));
}
findLink(token).incCount();
this.totalWeight++;
} |
08d4b4b8-09b8-4e82-9583-099e1fd0904b | @Override
public String toString() {
StringBuilder linksStr = new StringBuilder("'");
for (int i = 0; i < this.links.size(); i++) {
linksStr.append((i > 0) ? "','" : "");
linksStr.append(this.links.get(i).toString());
}
return linksStr.append("'").toString();
} |
b481523d-3a0c-4d50-8b79-3d9c65419e37 | State(char token) {
this.token = token;
} |
93cbeba0-5fc1-4240-b84a-949d402ad20e | public Character getToken() {
return this.token;
} |
c8f23902-d39e-4517-8c69-8be975cbc54c | public String getName() {
if (getToken() == INITIAL_STATE) {
return "INITIAL";
} else if (getToken() == FINAL_STATE) {
return "FINAL";
} else {
return getToken().toString();
}
} |
c1d065d6-f1a0-4972-aa7e-cadb66e00dba | public long getTotalWeight() {
return this.links.getTotalWeight();
} |
db80daee-e270-46a2-9ba0-bbbaae2d2555 | String getLinksAsString() {
return this.links.toString();
} |
db066397-6e7c-4e87-af41-f807e9ed674c | public char followRandomLinkToken() {
return this.links.getWeightedRandomLinkToken();
} |
b8c83b99-a3f1-4675-8361-c169bc3dd2f5 | public void recordLink(char token) {
links.recordLink(token);
} |
010ca4b6-b43d-4e81-a199-de8704dd1bb4 | @Override
public String toString() {
return "State{" +
"token='" + getName() + "\'," +
"links={" + getLinksAsString() + "}, " +
"total=" + getTotalWeight() + "}";
} |
b5333802-d2c8-4025-8d15-b4be7d16ea39 | Link(char name) {
this.token = name;
this.count = 0;
} |
38023f3d-3c34-4022-a5f9-66603c73c59f | public Character getToken() {
return this.token;
} |
1953996e-e28c-4dc2-89a4-6259923f0ba7 | String getName() {
if (getToken() == Constants.INITIAL_STATE) {
return "INITIAL";
} else if (getToken() == Constants.FINAL_STATE) {
return "FINAL";
} else {
return getToken().toString();
}
} |
2cc9d20f-adc5-4a51-b706-1a0da03ad25e | public void incCount() {
this.count++;
} |
cb5d647b-68db-49b8-a09f-8e89350ee41d | public long getCount() {
return this.count;
} |
52591691-06e0-41e7-a6e8-1e82dfcfe2a2 | @Override
public String toString() {
return getName() + " (" + getCount() + ")";
} |
dd4135bd-7f41-472b-9cee-bb02098e7c0e | public static void main(String[] args) {
States mtm = new States();
try {
File dir = new File(".");
File fin = new File(dir.getCanonicalPath() + File.separator + "testnames.txt");
mtm.trainFrom(fin);
} catch (IOException e) {
System.out.println(e.getMessage());
}
System.out.println(mtm.getMarkovName());
} |
e44d38af-64ce-4b22-905b-afd4d4f42b25 | public Launcher(){
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setTitle("DupCleaner");
this.setSize(405, 150);
this.setResizable(false);
this.setLocation(100, 100);
this.setLayout(null);
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex){}
JButton clean = new JButton("Start Cleaning");
clean.setBounds(10, 20, 380, 50);
clean.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
getFrame().setVisible(false);
new FileCleaner();
}
});
this.add(clean);
JButton about = new JButton("About");
about.setBounds(10, 80, 190, 30);
about.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
new AboutWindow();
}
});
this.add(about);
JButton quit = new JButton("Quit");
quit.setBounds(200, 80, 190, 30);
quit.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
this.add(quit);
this.repaint();
} |
301089ee-067e-4ad4-bbcc-2128773dca8c | @Override
public void actionPerformed(ActionEvent arg0) {
getFrame().setVisible(false);
new FileCleaner();
} |
d3586fea-561b-4416-9d30-ea62adfb359b | @Override
public void actionPerformed(ActionEvent e) {
new AboutWindow();
} |
b49f3fdf-ca3c-4b3f-a18d-74ec1d7dd10c | @Override
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
} |
d0851631-8d39-4cb7-95cf-2c5b76a3dcde | public static void main(String[] args){
new Launcher();
} |
ea5b6592-03e8-4d98-af3d-27104bc4b230 | public JFrame getFrame(){
return this;
} |
2580ab06-8b36-4049-aedd-9540d91a582e | public ReportViewer(String r, String t){
this.report = r;
this.title = t;
this.setTitle(this.title);
this.setSize(600, 400);
this.setLocation(150, 150);
this.setVisible(true);
this.setLayout(null);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.setResizable(false);
JTextArea txtReport = new JTextArea(report);
txtReport.setBounds(10, 10, 580, 380);
txtReport.setEditable(false);
txtReport.setFont(new Font("Courier New", Font.PLAIN, 14));
this.add(txtReport);
this.repaint();
} |
8ef22496-ddcc-4cc0-ba63-066e13045a68 | public AboutWindow(){
this.setVisible(true);
this.setTitle("About");
this.setLocation(200, 200);
this.setSize(500, 300);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.setResizable(false);
this.setLayout(null);
String a = "<html>"
+ "<b>DupCleaner v0.1</b><br>"
+ "A desktop app that finds duplicate files on the filesystem and helps you clean up.<br>"
+ "<br>Author: Jim Gao<br>"
+ "<br><br>Visit: </br>"
+ "https://github.com/jimthenerd/dupcleaner";
JLabel about = new JLabel(a);
about.setBounds(10, 10, 480, 180);
this.add(about);
} |
19e20f7f-119f-4b6c-8899-08e6cb97c9b7 | public ProgressWindow(){
this.setVisible(true);
this.setTitle("Progress");
this.setSize(400, 150);
this.setLocation(300, 200);
this.setLayout(null);
this.setResizable(false);
txtCounter = new JLabel("Loaded 0 files.");
txtCounter.setFont(new Font("Courier New", Font.BOLD, 15));
txtCounter.setBounds(100, 50, 200, 35);
this.add(txtCounter);
this.repaint();
} |
23599397-9740-4415-ad9c-03cc15095de0 | public void countUp(){
count++;
txtCounter.setText("Loaded " + count + " files.");
} |
6b7e0c7d-f0d3-4094-b098-2d76588ab863 | public void close(){
this.setVisible(false);
} |
710bfa38-fd7d-4379-b2b3-12e7ec9c5a26 | public static void main(String[] args){
new ProgressWindow();
} |
446170b2-e03f-4d96-94cc-00086bfa5741 | public FileCleaner(){
this.setVisible(true);
this.setTitle("DupCleaner");
this.setLocation(100, 100);
this.setSize(800, 600);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setLayout(null);
final DefaultListModel<String> flist = new DefaultListModel<String>();
final ArrayList<File> fileList = new ArrayList<File>();
JList files = new JList(flist);
files.setBounds(10, 10, 600, 550);
this.add(files);
JButton scan = new JButton("Scan Files");
scan.setBounds(620, 10, 160, 30);
scan.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
flist.clear();
fileList.clear();
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Select Folder");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
chooser.showOpenDialog(getParent());
String path = chooser.getSelectedFile().toString();
System.out.println(path);
ArrayList<File> files = new ArrayList<File>();
queryFiles(files, path);
ProgressWindow w = new ProgressWindow();
for (int i=0; i<files.size(); i++){
flist.addElement(files.get(i).getAbsolutePath());
System.out.println(files.get(i).getAbsolutePath());
fileList.add(files.get(i));
w.countUp();
}
w.close();
}
});
this.add(scan);
JButton report = new JButton("Generate Report");
report.setBounds(620, 50, 160, 30);
report.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
final ArrayList<File> firstGroup = new ArrayList<File>();
final ArrayList<File> secondGroup = new ArrayList<File>();
String report = "Duplicate Files: \n\n";
for (int i=0; i<flist.size(); i++){
for (int j=0; j<i; j++){
if (fileList.get(i).getName().equals(fileList.get(j).getName())){
firstGroup.add(fileList.get(i));
secondGroup.add(fileList.get(j));
report += (fileList.get(i).getAbsolutePath() + "\n" +
fileList.get(j).getAbsolutePath() + "\n\n");
}
}
}
report += "\n" + "End of Report";
new ReportViewer(report, "Duplicate Files");
}
});
this.add(report);
this.repaint();
} |
cbe3e169-61af-4143-8395-383cf35d06bf | @Override
public void actionPerformed(ActionEvent e) {
flist.clear();
fileList.clear();
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Select Folder");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
chooser.showOpenDialog(getParent());
String path = chooser.getSelectedFile().toString();
System.out.println(path);
ArrayList<File> files = new ArrayList<File>();
queryFiles(files, path);
ProgressWindow w = new ProgressWindow();
for (int i=0; i<files.size(); i++){
flist.addElement(files.get(i).getAbsolutePath());
System.out.println(files.get(i).getAbsolutePath());
fileList.add(files.get(i));
w.countUp();
}
w.close();
} |
9994b0ea-f457-4233-93d1-c4df6e09ec8b | @Override
public void actionPerformed(ActionEvent arg0) {
final ArrayList<File> firstGroup = new ArrayList<File>();
final ArrayList<File> secondGroup = new ArrayList<File>();
String report = "Duplicate Files: \n\n";
for (int i=0; i<flist.size(); i++){
for (int j=0; j<i; j++){
if (fileList.get(i).getName().equals(fileList.get(j).getName())){
firstGroup.add(fileList.get(i));
secondGroup.add(fileList.get(j));
report += (fileList.get(i).getAbsolutePath() + "\n" +
fileList.get(j).getAbsolutePath() + "\n\n");
}
}
}
report += "\n" + "End of Report";
new ReportViewer(report, "Duplicate Files");
} |
2313c480-ed88-4972-92ff-fdffad7580ab | public void queryFiles(ArrayList<File> files, String path){
File directory = new File(path);
File[] f = directory.listFiles();
for (int i=0; i<f.length; i++){
if (f[i].isFile()){
files.add(f[i]);
} else if (f[i].isDirectory()){
queryFiles(files, f[i].getAbsolutePath());
}
}
} |
085af59c-9a0d-4e4a-b59c-30b2ced2c92b | public String getRate() {
return mRate;
} |
cbbeda1f-29e9-418a-b209-ec29fccd2878 | public void setRate(String pRate) {
mRate = pRate;
} |
8758ba21-313a-4b77-b211-f22d92dfa2ec | public String getTolerance() {
return mTolerance;
} |
d6f45282-bb99-429c-8849-36478ee6df91 | public void setTolerance(String pTolerance) {
mTolerance = pTolerance;
} |
9584054d-b56f-4d5d-9545-5f40f37e2f39 | public String getMaxrate() {
return mMaxrate;
} |
35854dbe-641c-4a99-a334-5e94617536c4 | public void setMaxrate(String pMaxrate) {
mMaxrate = pMaxrate;
} |
babf391b-d440-4386-abd3-59378601a79b | public String getMinrate() {
return mMinrate;
} |
0fc35aae-12da-49e0-be10-32aec3dfcfd7 | public void setMinrate(String pMinrate) {
mMinrate = pMinrate;
} |
745ee151-2fca-475c-817f-ed7232c4a459 | public String getBufsize() {
return mBufsize;
} |
08634ff6-a938-4cb1-a776-0b2a89d9ce53 | public void setBufsize(String pBufsize) {
mBufsize = pBufsize;
} |
0a5d31ab-4cf6-47c7-a6b3-32c3b018ed63 | @Override
public String toString() {
return "Bitrate [mRate=" + mRate + ", mTolerance=" + mTolerance
+ ", mMaxrate=" + mMaxrate + ", mMinrate=" + mMinrate
+ ", mBufsize=" + mBufsize + "]";
} |
12e1409b-f4b7-45c2-b00f-8ca7460b9f5e | public Integer getNumber() {
return mNumber;
} |
f27b645e-8bfd-40fe-a732-fc08e5eea6ec | public void setNumber(Integer pNumber) {
mNumber = pNumber;
} |
ffcac906-1a20-4bcb-bbed-9289bf1097a2 | public String getSize() {
return mSize;
} |
c5e331a7-f8da-42d0-82fe-eaf43dbe26b0 | public void setSize(String pSize) {
mSize = pSize;
} |
d4a7439e-9c2e-41de-92af-caad8bb2f399 | public ThumbnailFormat getFormat() {
return ThumbnailFormat.fromValue(mFormat);
} |
b43d0980-b47f-42c6-b7e1-536f218280db | public void setFormat(ThumbnailFormat pFormat) {
mFormat = pFormat.getValue();
} |
5cf36d50-938b-4a4e-89a3-ac4a40f01baa | public String getOutputName() {
return mOutputName;
} |
cc3f2019-75f4-4c8d-8d67-9cb2dab31a1b | public void setOutputName(String pOutputName) {
mOutputName = pOutputName;
} |
2236de09-8d97-443f-b261-693c560e977e | @Override
public String toString() {
return "Thumbnail [mNumber=" + mNumber + ", mSize=" + mSize
+ ", mFormat=" + mFormat + ", mOutputName=" + mOutputName + "]";
} |
7cd8302e-1420-4f25-a4e9-f71966e8db06 | public String getFilter() {
return mFilter;
} |
5acebbb1-bca5-4cee-90ca-bab82fdf2114 | public void setFilter(String pFilter) {
mFilter = pFilter;
} |
9a17bfb4-87b7-402c-8e59-ed702747404f | public String getFormat() {
return mFormat;
} |
2da41d99-363e-4fcc-9bda-1fb3d33d3702 | public void setFormat(String pFormat) {
mFormat = pFormat;
} |
d578351c-6709-4162-9c53-a598bdca4a91 | public Integer getSegmentTime() {
return mSegmentTime;
} |
68d80706-dc66-400e-8950-492f6705802a | public void setSegmentTime(Integer pSegmentTime) {
mSegmentTime = pSegmentTime;
} |
11b2bf9a-5c10-4e8b-8955-ca32aa94e2d5 | @Override
public String toString() {
return "HLSStream [mFilter=" + mFilter + ", mFormat=" + mFormat
+ ", mSegmentTime=" + mSegmentTime + "]";
} |
bc0ab126-aa77-4328-9423-3b7c5666b93c | public String getObject() {
return mObject;
} |
307ee8c6-90d6-4c34-82e8-c5dd7d4907bd | public void setObject(String pObject) {
mObject = pObject;
} |
346d371f-14c7-4299-8f8f-10328dc8c5d5 | @Override
public String toString() {
return "OverlayInput [mObject=" + mObject + "]";
} |
43b22df3-d6ad-449f-9e0f-08dcda0792d6 | public Integer getAC() {
return mAC;
} |
380b4493-ecad-4097-b31d-e02d4995a859 | public void setAC(Integer pAC) {
mAC = pAC;
} |
540a0be9-1b16-4a0a-934f-3c8ec4e2cb1a | public String getAB() {
return mAB;
} |
3cdf26a1-0e3c-4187-9e66-ac5ccffb3f3d | public void setAB(String pAB) {
mAB = pAB;
} |
bc5fc54b-cb62-4b93-91b8-6d571b993bb8 | public Long getAR() {
return mAR;
} |
8ad185ca-2943-4e62-a233-6391f42c3179 | public void setAR(Long pAR) {
mAR = pAR;
} |
49fd4203-9494-49ca-b740-c4d6ee972914 | @Override
public String toString() {
return "AudioAdvanced [mAC=" + mAC + ", mAB=" + mAB + ", mAR=" + mAR
+ "]";
} |
8c38737f-c68d-409d-9e56-51813a532e70 | public String getFilename() {
return mFilename;
} |
2c5d8260-d755-40c0-aa1e-3c7fca856c3e | public void setFilename(String pFilename) {
mFilename = pFilename;
} |
95be7af5-392a-41ff-b8a6-eb77b1749ad7 | @Override
public String toString() {
return "OverlayMulti [mFilename=" + mFilename + "]";
} |
5f40aa4c-806a-489b-89c5-add74708b0ce | public AudioCodec getCodec() {
return AudioCodec.fromValue(mCodec);
} |
5d5f97d3-4746-4406-86f7-682689ee1ece | public void setCodec(AudioCodec pCodec) {
mCodec = pCodec.getValue();
} |
1b19dfee-07d5-43b9-9067-5feb118ebb9c | public Boolean isDisable() {
return mDisable;
} |
f2867ef5-d8e0-4a8b-96e3-9ae3d814d625 | public void setDisable(Boolean pDisable) {
mDisable = pDisable;
} |
90f34a84-e946-42ed-80d8-47b84987ce2c | public Long getFrequency() {
return mFrequency;
} |
2497c00d-ce1a-4466-b244-31ed666480b6 | public void setFrequency(Long pFrequency) {
mFrequency = pFrequency;
} |
eb030dd7-c99f-4c59-a7b9-eed198270ade | public String getBitrate() {
return mBitrate;
} |
584d6398-84d1-4dd8-add9-60d919a043c4 | public void setBitrate(String pBitrate) {
mBitrate = pBitrate;
} |
2efc0c59-9dc7-45a5-bd90-e6804e596146 | public String getChannels() {
return mChannels;
} |
7fb4e77f-3a0f-46ae-b716-8d0316aae1a9 | public void setChannels(String pChannels) {
mChannels = pChannels;
} |
e72c961c-e21e-4dc1-a3dd-a5fd5fbfc1a5 | public Integer getQuality() {
return mQuality;
} |
0d0ea12d-6cd4-4fb0-9348-3d9fca7a5903 | public void setQuality(Integer pQuality) {
mQuality = pQuality;
} |
458252f0-27a2-4aaa-8ec5-c0178e54eedf | public AudioAdvanced getAdvanced() {
return mAdvanced;
} |
acd5f1d0-8bd5-448f-a744-89226654ecde | public void setAdvanced(AudioAdvanced pAdvanced) {
mAdvanced = pAdvanced;
} |
a20413ea-0c9e-499d-9d8c-9220341a3d5e | @Override
public String toString() {
return "Audio [mCodec=" + mCodec + ", mDisable=" + mDisable
+ ", mFrequency=" + mFrequency + ", mBitrate=" + mBitrate
+ ", mChannels=" + mChannels + ", mQuality=" + mQuality
+ ", mAdvanced=" + mAdvanced + "]";
} |
b19285db-1e99-4060-aca8-daa8fece86be | public String getWOffset() {
return mWOffset;
} |
25ab2986-9800-4bb7-93d9-8ce1729d454c | public void setWOffset(String pWOffset) {
mWOffset = pWOffset;
} |
29cb7a6a-983d-47bd-994c-7d054f7ce34f | public String getHOffset() {
return mHOffset;
} |
b8f85cf9-2fc4-4c82-8031-799091a11f61 | public void setHOffset(String pHOffset) {
mHOffset = pHOffset;
} |
9a4841df-e597-46d7-9c05-b89326f3e53c | public OverlayInput getInput() {
return mInput;
} |
a1de3cf9-ce4f-4e90-a07b-359b237270a1 | public void setInput(OverlayInput pInput) {
mInput = pInput;
} |
9fbd73c3-b42d-4112-a4e0-7e51809217af | public OverlayMulti getMulti() {
return mMulti;
} |
15a3a0cc-5d15-466e-8e5e-d31f7fe725dd | public void setMulti(OverlayMulti pMulti) {
mMulti = pMulti;
} |
0397843b-ac7d-4f55-be8c-1f44a177f921 | @Override
public String toString() {
return "Overlay [mWOffset=" + mWOffset + ", mHOffset=" + mHOffset
+ ", mInput=" + mInput + ", mMulti=" + mMulti + "]";
} |
6548060b-9bf6-4390-b073-99a7b5477be9 | public String getKey() {
return mKey;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.