Debian Codegraph @

Source/Control/Interface/CommandLine/CCLIClassClassificationComandLinePreparationTranslator.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CCLIClassClassificationComandLinePreparationTranslator.h"
22
23
24 namespace Konclude {
25
26 namespace Control {
27
28 namespace Interface {
29
30 namespace CommandLine {
31
32 CCLIClassClassificationComandLinePreparationTranslator::CCLIClassClassificationComandLinePreparationTranslator(CLoaderFactory *loaderFactory) : CCLIComandLinePreparationTranslator(loaderFactory) {
33 mOperationTypeString = QString("Classification");
34 mMinNecessaryArguments = true;
35 mFirstArgumentTranslation = false;
36 mLoaderTypeString = QString("-CLIClassClassificationBatchProcessingLoader");
37
38 mTranslationStringSet.insert(QString("classify").toUpper());
39 mTranslationStringSet.insert(QString("classifyclasses").toUpper());
40 mTranslationStringSet.insert(QString("classifyconcepts").toUpper());
41 mTranslationStringSet.insert(QString("classification").toUpper());
42 mTranslationStringSet.insert(QString("classclassification").toUpper());
43 mTranslationStringSet.insert(QString("conceptclassification").toUpper());
44 }
45
46
47 CCLIClassClassificationComandLinePreparationTranslator::~CCLIClassClassificationComandLinePreparationTranslator() {
48 }
49
50 bool CCLIClassClassificationComandLinePreparationTranslator::hasNeccessaryParameters() {
51 bool minNecessaryArguments = true;
52 if (!mFirstArgumentTranslation) {
53 minNecessaryArguments = false;
54 }
55 if (!mRequestFileTranslated) {
56 LOG(ERROR,getLogDomain(),logTr("%1 request file not specified.").arg(mOperationTypeString),this);
57 minNecessaryArguments = false;
58 }
59 return minNecessaryArguments;
60 }
61
62 bool CCLIClassClassificationComandLinePreparationTranslator::translate(const QString& argumentText, QStringList& remainingArgList) {
63
64 bool argumentTranslated = false;
65
66
67 QString modArgText = argumentText.trimmed();
68 if (!mSkipTranslation) {
69 if (CCommandLinePreparationTranslator::translate(argumentText,remainingArgList)) {
70 argumentTranslated = true;
71 } else {
72 if (modArgText.indexOf("-") == 0) {
73 } else if (mTranslationStringSet.contains(modArgText.toUpper())) {
74 argumentTranslated = true;
75 mFirstArgumentTranslation = true;
76 }
77 }
78 }
79 return argumentTranslated;
80 }
81
82 bool CCLIClassClassificationComandLinePreparationTranslator::canTranslate(const QString& string) {
83 if (mTranslationStringSet.contains(string.toUpper())) {
84 return true;
85 }
86 return false;
87 }
88
89
90 }; // end namespace CommandLine
91
92 }; // end namespace Interface
93
94 }; // end namespace Control
95
96 }; // end namespace Konclude