Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions use-core/src/main/java/org/tzi/use/uml/mm/MAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import com.google.common.base.Optional;

import java.util.Objects;

/**
* An Attribute is a model element that is part of a classifier.
*
Expand Down Expand Up @@ -73,7 +75,7 @@ public Type type() {
/**
* <code>true</code> if a derive expression is specified for
* this attribute.
* @return
* @return <code>true</code> if a derive expression is specified for this attribute.
*/
public boolean isDerived() {
return deriveExpression != null;
Expand Down Expand Up @@ -141,14 +143,18 @@ public String toString() {
public boolean equals(Object obj) {
if (obj == this )
return true;
if (obj instanceof MAttribute ) {
MAttribute other = (MAttribute)obj;
if (obj instanceof MAttribute other) {
return fOwner.equals(other.fOwner) && name().equals(other.name());
}

return false;
}


@Override
public int hashCode() {
return Objects.hash(super.hashCode(), fOwner);
}
Comment thread
h-man2 marked this conversation as resolved.

/**
* Process this element with visitor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public MDataTypeValueState(MDataTypeValue instance) {

List<MAttribute> atts = instance.cls().allAttributes();
// initialize attribute slots with instance values
fAttrSlots = new IdentityHashMap<MAttribute, Value>(atts.size());
fAttrSlots = new HashMap<>(atts.size());

for (MAttribute attr : atts) {
fAttrSlots.put(attr, instance.value().getValues().get(attr.name()));
Expand All @@ -58,7 +58,7 @@ public MDataTypeValueState(MDataTypeValue instance) {
* Copy constructor.
*/
public MDataTypeValueState(MDataTypeValueState x) {
this.fAttrSlots = new IdentityHashMap<MAttribute, Value>(x.fAttrSlots);
this.fAttrSlots = new HashMap<>(x.fAttrSlots);
Comment thread
h-man2 marked this conversation as resolved.
this.fInstance = x.fInstance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ dataType Time
pre: hour >= 0 and hour < 24
pre: minute >= 0 and minute < 60
pre: second >= 0 and second < 60

before(other: Time) : Boolean =
self.hour < other.hour implies
self.minute < other.minute implies
self.second < other.second
Comment thread
h-man2 marked this conversation as resolved.
Outdated
end
Loading