Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
57f5c0a2
Commit
57f5c0a2
authored
2 years ago
by
Ludovic Apvrille
Browse files
Options
Downloads
Patches
Plain Diff
Improvement on ai
parent
5d36d372
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/ui/window/JFrameAI.java
+33
-5
33 additions, 5 deletions
src/main/java/ui/window/JFrameAI.java
with
33 additions
and
5 deletions
src/main/java/ui/window/JFrameAI.java
+
33
−
5
View file @
57f5c0a2
...
...
@@ -70,10 +70,10 @@ import java.awt.event.MouseEvent;
*/
public
class
JFrameAI
extends
JFrame
implements
ActionListener
,
Runnable
{
private
static
int
IDENTIFY_REQUIREMENT
=
1
;
private
static
int
KIND_CLASSIFY_REQUIREMENT
=
2
;
private
static
int
KIND_CLASSIFY_REQUIREMENT
=
1
;
private
static
String
[]
POSSIBLE_ACTIONS
=
{
"Chat"
,
"Classify requirements"
};
private
static
String
[]
POSSIBLE_ACTIONS
=
{
"Chat"
,
"Identify requirements"
,
"Classify requirements"
};
protected
JComboBox
<
String
>
listOfPossibleActions
;
private
String
QUESTION_CLASSIFY_REQ
=
"I would like to identify the \"type\" attribute, i.e. the classification, "
+
"of the following requirements. Could you give me a correct type among: safety, security, functional, "
+
...
...
@@ -81,6 +81,10 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
"following sub categories: privacy, confidentiality, non-repudiation, controlled access, availability,"
+
"immunity, data origin authenticity, freshness. Use the following format for the answer:"
+
" - Requirement name: classification\n"
;
private
String
QUESTION_IDENTIFY_REQ
=
"Identify the requirements of the following specification. List them as follows: "
+
"- name of the requirement: text of the requirement ; link to other requirements (derive, refine, compose). The name "
+
"should be an english "
+
"name and not a number or an identifier"
;
private
MainGUI
mgui
;
private
JTextPane
question
,
answer
,
console
;
private
String
automatedAnswer
;
...
...
@@ -337,11 +341,13 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
simpleChat
();
}
if
(
listOfPossibleActions
.
getSelectedIndex
()
==
1
)
{
if
(
listOfPossibleActions
.
getSelectedIndex
()
==
KIND_CLASSIFY_REQUIREMENT
)
{
classifyRequirements
();
}
if
(
listOfPossibleActions
.
getSelectedIndex
()
==
IDENTIFY_REQUIREMENT
)
{
identifyRequirements
();
}
}
go
=
false
;
...
...
@@ -372,6 +378,23 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
}
private
void
identifyRequirements
()
{
inform
(
"Identifying requirements\n"
);
TDiagramPanel
tdp
=
mgui
.
getCurrentTDiagramPanel
();
if
(!(
tdp
instanceof
AvatarRDPanel
))
{
error
(
"A requirement diagram must be selected first"
);
return
;
}
if
(!
hasQuestion
())
{
error
(
"A system specification must be provided in the \"question\" area"
);
return
;
}
TraceManager
.
addDev
(
"Asking for requirements"
);
String
questionT
=
"\nTTool:"
+
QUESTION_IDENTIFY_REQ
+
"\n"
+
question
.
getText
().
trim
()
+
"\n"
;
makeQuestion
(
questionT
,
IDENTIFY_REQUIREMENT
,
tdp
);
}
private
void
classifyRequirements
()
{
inform
(
"Classifying requirements is selected\n"
);
TDiagramPanel
tdp
=
mgui
.
getCurrentTDiagramPanel
();
...
...
@@ -443,6 +466,11 @@ public class JFrameAI extends JFrame implements ActionListener, Runnable {
}
public
boolean
hasQuestion
()
{
return
question
.
getText
().
trim
().
length
()
>
0
;
}
}
// Class
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment