-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #476 from bci-oss/475-allow-loading-custom-quantit…
…y-kinds Fix loading of custom quantity kind definitions
- Loading branch information
Showing
11 changed files
with
334 additions
and
124 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
...ct-meta-model-java/src/main/java/org/eclipse/esmf/metamodel/impl/DefaultQuantityKind.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,73 @@ | ||
/* | ||
* Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH | ||
* | ||
* See the AUTHORS file(s) distributed with this work for additional | ||
* information regarding authorship. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
package org.eclipse.esmf.metamodel.impl; | ||
|
||
import java.util.Objects; | ||
import java.util.StringJoiner; | ||
|
||
import org.eclipse.esmf.metamodel.QuantityKind; | ||
import org.eclipse.esmf.metamodel.loader.MetaModelBaseAttributes; | ||
import org.eclipse.esmf.metamodel.visitor.AspectVisitor; | ||
|
||
public class DefaultQuantityKind extends ModelElementImpl implements QuantityKind { | ||
private final String label; | ||
|
||
public DefaultQuantityKind( final MetaModelBaseAttributes metaModelBaseAttributes, final String label ) { | ||
super( metaModelBaseAttributes ); | ||
this.label = label; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
@Override | ||
public boolean equals( final Object o ) { | ||
if ( this == o ) { | ||
return true; | ||
} | ||
if ( o == null || getClass() != o.getClass() ) { | ||
return false; | ||
} | ||
if ( !super.equals( o ) ) { | ||
return false; | ||
} | ||
final DefaultQuantityKind that = (DefaultQuantityKind) o; | ||
return Objects.equals( label, that.label ); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash( super.hashCode(), label ); | ||
} | ||
|
||
/** | ||
* Accepts an Aspect visitor | ||
* | ||
* @param visitor The visitor to accept | ||
* @param <T> The result type of the traversal operation | ||
* @param <C> The context of the visitor traversal | ||
*/ | ||
@Override | ||
public <T, C> T accept( final AspectVisitor<T, C> visitor, final C context ) { | ||
return visitor.visitQuantityKind( this, context ); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new StringJoiner( ", ", DefaultQuantityKind.class.getSimpleName() + "[", "]" ) | ||
.toString(); | ||
} | ||
} |
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
Oops, something went wrong.