This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified project structure. Added loading information frame for que…
…ry executions. Fixed a few bugs.
- Loading branch information
Vlad-Adrian Moglan
committed
Feb 4, 2019
1 parent
9d10ff2
commit 24a235f
Showing
25 changed files
with
832 additions
and
749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
src/main/java/com/movlad/semviz/application/QueryManagerController.java
This file was deleted.
Oops, something went wrong.
99 changes: 99 additions & 0 deletions
99
src/main/java/com/movlad/semviz/application/SQMController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.movlad.semviz.application; | ||
|
||
import com.movlad.semviz.core.io.InvalidDirectoryException; | ||
import com.movlad.semviz.core.sqm.SQM; | ||
import com.movlad.semviz.core.sqm.SemanticCloudDescription; | ||
import java.io.FileNotFoundException; | ||
import java.nio.file.NotDirectoryException; | ||
import java.util.List; | ||
|
||
/** | ||
* Controller for the Semviz Query Manager. | ||
*/ | ||
public final class SQMController extends Controller { | ||
|
||
private static SQMController instance = null; | ||
private final SQM sqm; // the unique instance of the Semviz Query Manager | ||
private List<SemanticCloudDescription> descriptions; // the list of current query results | ||
private int selectedDescriptionIndex; // the currently selected Description | ||
|
||
private SQMController() { | ||
sqm = SQM.getInstance(); | ||
selectedDescriptionIndex = -1; | ||
} | ||
|
||
public static SQMController getInstance() { | ||
if (instance == null) { | ||
instance = new SQMController(); | ||
} | ||
|
||
return instance; | ||
} | ||
|
||
/** | ||
* @return the currently selected description | ||
*/ | ||
public SemanticCloudDescription getSelectedDescription() { | ||
if (selectedDescriptionIndex > -1 | ||
&& selectedDescriptionIndex < descriptions.size()) { | ||
return descriptions.get(selectedDescriptionIndex); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* Given a Semviz directory, this method loads a Semviz directory into the | ||
* Semviz query manager singleton. | ||
* | ||
* @param path is the path to the Semviz directory | ||
*/ | ||
public void load(String path) { | ||
if (descriptions != null) { | ||
descriptions.clear(); | ||
} | ||
|
||
try { | ||
sqm.load(path); | ||
|
||
changeSupport.firePropertyChange("SQMLoadSuccess", null, sqm); | ||
} catch (InvalidDirectoryException | NotDirectoryException | FileNotFoundException e) { | ||
changeSupport.firePropertyChange("SQMLoadError", null, e.getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Executes a query on the currently loaded Semviz directory. | ||
* | ||
* @param queryString is the string of the query to be executed | ||
*/ | ||
public void exec(String queryString) { | ||
List<SemanticCloudDescription> prevDescriptions = descriptions; | ||
|
||
try { | ||
changeSupport.firePropertyChange("SQMExecutionStarted", null, sqm); | ||
|
||
descriptions = sqm.exec(queryString); | ||
|
||
changeSupport.firePropertyChange("SQMFailCountChanged", null, sqm.getFailCount()); | ||
changeSupport.firePropertyChange("SQMExecutionSuccess", prevDescriptions, descriptions); | ||
} catch (Exception e) { | ||
changeSupport.firePropertyChange("SQMExecutionError", null, e.getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Sets the selected semantic cloud description index. | ||
* | ||
* @param i is the index of the selected description | ||
*/ | ||
public void setSelectedDescriptionIndex(int i) { | ||
int prev = selectedDescriptionIndex; | ||
|
||
selectedDescriptionIndex = i; | ||
|
||
changeSupport.firePropertyChange("SQMDescriptionIndexChanged", prev, | ||
selectedDescriptionIndex); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.