Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NeqModPlus
de.hft-stuttgart.cityunits
Commits
8c7a07e5
Commit
8c7a07e5
authored
Jun 03, 2021
by
Kai-Holger Brassel
Browse files
Forgot code generation resulting in missing validator class etc.
parent
9b552652
Pipeline
#3928
passed with stage
in 2 minutes and 43 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
de.hftstuttgart.cityunits.model/META-INF/MANIFEST.MF
View file @
8c7a07e5
...
...
@@ -19,4 +19,5 @@ Export-Package: de.hftstuttgart.cityunits.model;
tech.units.indriya",
de.hftstuttgart.cityunits.model.quantities;
uses:="org.eclipse.emf.ecore",
de.hftstuttgart.cityunits.model.quantities.impl
de.hftstuttgart.cityunits.model.quantities.impl,
de.hftstuttgart.cityunits.model.quantities.util
de.hftstuttgart.cityunits.model/model/Quantities.genmodel
View file @
8c7a07e5
...
...
@@ -11,5 +11,6 @@
convert=
"return it == null ? null : it.toString();"
/>
<genDataTypes
ecoreDataType=
"Quantities.ecore#//QuantityLong"
create=
"return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);"
convert=
"return it == null ? null : it.toString();"
/>
<genDataTypes
ecoreDataType=
"Quantities.ecore#//Fraction"
/>
</genPackages>
</genmodel:GenModel>
de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/quantities/QuantitiesPackage.java
View file @
8c7a07e5
...
...
@@ -115,7 +115,7 @@ public interface QuantitiesPackage extends EPackage {
* @return the meta object for data type '<em>Fraction</em>'.
* @see java.lang.Double
* @model instanceClass="java.lang.Double"
*
annotation="https:///org/eclipse/emf/ecore/util/E
xtendedMetaData
minInclusive='0.0' maxInclusive='1.0'"
*
e
xtendedMetaData
="
minInclusive='0.0' maxInclusive='1.0'"
* @generated
*/
EDataType
getFraction
();
...
...
de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/quantities/impl/QuantitiesPackageImpl.java
View file @
8c7a07e5
...
...
@@ -6,9 +6,11 @@ import de.hftstuttgart.cityunits.model.NullableQuantity;
import
de.hftstuttgart.cityunits.model.quantities.QuantitiesFactory
;
import
de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage
;
import
de.hftstuttgart.cityunits.model.quantities.util.QuantitiesValidator
;
import
org.eclipse.emf.ecore.EDataType
;
import
org.eclipse.emf.ecore.EPackage
;
import
org.eclipse.emf.ecore.EValidator
;
import
org.eclipse.emf.ecore.impl.EPackageImpl
;
/**
...
...
@@ -92,6 +94,16 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
// Initialize created meta-data
theQuantitiesPackage
.
initializePackageContents
();
// Register package validator
EValidator
.
Registry
.
INSTANCE
.
put
(
theQuantitiesPackage
,
new
EValidator
.
Descriptor
()
{
@Override
public
EValidator
getEValidator
()
{
return
QuantitiesValidator
.
INSTANCE
;
}
});
// Mark meta-data to indicate it can't be changed
theQuantitiesPackage
.
freeze
();
...
...
@@ -196,18 +208,18 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
createResource
(
eNS_URI
);
// Create annotations
// http
s
:///org/eclipse/emf/ecore/util/ExtendedMetaData
// http:///org/eclipse/emf/ecore/util/ExtendedMetaData
createExtendedMetaDataAnnotations
();
}
/**
* Initializes the annotations for <b>http
s
:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
* Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected
void
createExtendedMetaDataAnnotations
()
{
String
source
=
"http
s
:///org/eclipse/emf/ecore/util/ExtendedMetaData"
;
String
source
=
"http:///org/eclipse/emf/ecore/util/ExtendedMetaData"
;
addAnnotation
(
fractionEDataType
,
source
,
...
...
de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/quantities/util/QuantitiesValidator.java
0 → 100644
View file @
8c7a07e5
/**
*/
package
de.hftstuttgart.cityunits.model.quantities.util
;
import
de.hftstuttgart.cityunits.model.NullableQuantity
;
import
de.hftstuttgart.cityunits.model.quantities.*
;
import
java.util.Map
;
import
org.eclipse.emf.common.util.DiagnosticChain
;
import
org.eclipse.emf.common.util.ResourceLocator
;
import
org.eclipse.emf.ecore.EPackage
;
import
org.eclipse.emf.ecore.util.EObjectValidator
;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage
* @generated
*/
public
class
QuantitiesValidator
extends
EObjectValidator
{
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
static
final
QuantitiesValidator
INSTANCE
=
new
QuantitiesValidator
();
/**
* A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.common.util.Diagnostic#getSource()
* @see org.eclipse.emf.common.util.Diagnostic#getCode()
* @generated
*/
public
static
final
String
DIAGNOSTIC_SOURCE
=
"de.hftstuttgart.cityunits.model.quantities"
;
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private
static
final
int
GENERATED_DIAGNOSTIC_CODE_COUNT
=
0
;
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected
static
final
int
DIAGNOSTIC_CODE_COUNT
=
GENERATED_DIAGNOSTIC_CODE_COUNT
;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
QuantitiesValidator
()
{
super
();
}
/**
* Returns the package of this validator switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected
EPackage
getEPackage
()
{
return
QuantitiesPackage
.
eINSTANCE
;
}
/**
* Calls <code>validateXXX</code> for the corresponding classifier of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected
boolean
validate
(
int
classifierID
,
Object
value
,
DiagnosticChain
diagnostics
,
Map
<
Object
,
Object
>
context
)
{
switch
(
classifierID
)
{
case
QuantitiesPackage
.
QUANTITY_DOUBLE
:
return
validateQuantityDouble
((
NullableQuantity
)
value
,
diagnostics
,
context
);
case
QuantitiesPackage
.
QUANTITY_LONG
:
return
validateQuantityLong
((
NullableQuantity
)
value
,
diagnostics
,
context
);
case
QuantitiesPackage
.
FRACTION
:
return
validateFraction
((
Double
)
value
,
diagnostics
,
context
);
default
:
return
true
;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
boolean
validateQuantityDouble
(
NullableQuantity
quantityDouble
,
DiagnosticChain
diagnostics
,
Map
<
Object
,
Object
>
context
)
{
return
true
;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
boolean
validateQuantityLong
(
NullableQuantity
quantityLong
,
DiagnosticChain
diagnostics
,
Map
<
Object
,
Object
>
context
)
{
return
true
;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
boolean
validateFraction
(
Double
fraction
,
DiagnosticChain
diagnostics
,
Map
<
Object
,
Object
>
context
)
{
boolean
result
=
validateFraction_Min
(
fraction
,
diagnostics
,
context
);
if
(
result
||
diagnostics
!=
null
)
result
&=
validateFraction_Max
(
fraction
,
diagnostics
,
context
);
return
result
;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @see #validateFraction_Min
*/
public
static
final
Double
FRACTION__MIN__VALUE
=
Double
.
valueOf
(
0.0
);
/**
* Validates the Min constraint of '<em>Fraction</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
boolean
validateFraction_Min
(
Double
fraction
,
DiagnosticChain
diagnostics
,
Map
<
Object
,
Object
>
context
)
{
boolean
result
=
fraction
.
compareTo
(
FRACTION__MIN__VALUE
)
>=
0
;
if
(!
result
&&
diagnostics
!=
null
)
reportMinViolation
(
QuantitiesPackage
.
Literals
.
FRACTION
,
fraction
,
FRACTION__MIN__VALUE
,
true
,
diagnostics
,
context
);
return
result
;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @see #validateFraction_Max
*/
public
static
final
Double
FRACTION__MAX__VALUE
=
Double
.
valueOf
(
1.0
);
/**
* Validates the Max constraint of '<em>Fraction</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public
boolean
validateFraction_Max
(
Double
fraction
,
DiagnosticChain
diagnostics
,
Map
<
Object
,
Object
>
context
)
{
boolean
result
=
fraction
.
compareTo
(
FRACTION__MAX__VALUE
)
<=
0
;
if
(!
result
&&
diagnostics
!=
null
)
reportMaxViolation
(
QuantitiesPackage
.
Literals
.
FRACTION
,
fraction
,
FRACTION__MAX__VALUE
,
true
,
diagnostics
,
context
);
return
result
;
}
/**
* Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public
ResourceLocator
getResourceLocator
()
{
// TODO
// Specialize this to return a resource locator for messages specific to this validator.
// Ensure that you remove @generated or mark it @generated NOT
return
super
.
getResourceLocator
();
}
}
//QuantitiesValidator
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment