use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.
the class PublicationProxy method getRights.
@SuppressWarnings("rawtypes")
public String getRights() {
EList<Rights> rights = publication.getPackage().getMetadata().getRights();
if (rights.size() > 0) {
FeatureMap fm = rights.get(0).getMixed();
Object o = fm.get(TEXT, false);
if (o instanceof FeatureEList) {
if (((FeatureEList) o).size() > 0) {
return ((FeatureEList) o).get(0).toString();
}
}
}
return EMPTY_STRING;
}
use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.
the class PublicationProxy method getCreator.
/**
* Returns the name of the first instance of an {@link Creator} in the publication. If a value has not been assigned
* an empty string will be returned.
*
* @return the creator name
*/
@SuppressWarnings("rawtypes")
public String getCreator() {
EList<Creator> creators = publication.getPackage().getMetadata().getCreators();
if (creators.size() > 0) {
FeatureMap fm = creators.get(0).getMixed();
Object o = fm.get(TEXT, false);
if (o instanceof FeatureEList) {
if (((FeatureEList) o).size() > 0) {
return ((FeatureEList) o).get(0).toString();
}
}
}
return EMPTY_STRING;
}
use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.
the class TestOPSPublication method getText.
@SuppressWarnings("rawtypes")
public String getText(Object element) {
if (element instanceof NavPoint) {
FeatureMap fm = ((NavPoint) element).getNavLabels().get(0).getText().getMixed();
Object o = fm.get(TEXT, false);
if (o instanceof FeatureEList) {
if (((FeatureEList) o).size() > 0) {
return ((FeatureEList) o).get(0).toString();
}
}
}
if (element instanceof Meta) {
Object o = ((Meta) element).getContent();
return o.toString();
}
return "null";
}
use of org.eclipse.emf.ecore.util.FeatureMap in project statecharts by Yakindu.
the class DerivedEObjectEList method size.
@Override
public int size() {
if (sourceFeatureIDs != null) {
EList<Object> values = new UniqueEList.FastCompare<Object>();
for (int i = 0; i < sourceFeatureIDs.length; i++) {
int sourceFeatureID = sourceFeatureIDs[i];
if (owner.eIsSet(sourceFeatureID)) {
EStructuralFeature sourceFeature = getEStructuralFeature(sourceFeatureID);
Object value = owner.eGet(sourceFeatureID, false, true);
if (FeatureMapUtil.isFeatureMap(sourceFeature)) {
FeatureMap featureMap = (FeatureMap) value;
for (int j = 0, size = featureMap.size(); j < size; j++) {
value = featureMap.getValue(j);
if (isIncluded(featureMap.getEStructuralFeature(j)) ? value != null : isIncluded(value)) {
values.add(value);
}
}
} else if (isIncluded(sourceFeature)) {
if (sourceFeature.isMany()) {
InternalEList<?> valuesList = (InternalEList<?>) value;
if (valuesList instanceof RandomAccess) {
for (int j = 0, size = valuesList.size(); j < size; j++) {
values.add(valuesList.basicGet(j));
}
} else {
for (Iterator<?> v = valuesList.basicIterator(); v.hasNext(); ) {
values.add(v.next());
}
}
} else if (value != null) {
values.add(value);
}
} else {
if (sourceFeature.isMany()) {
InternalEList<?> valuesList = (InternalEList<?>) value;
if (valuesList instanceof RandomAccess) {
for (int j = 0, size = valuesList.size(); j < size; j++) {
value = valuesList.basicGet(j);
if (isIncluded(value)) {
values.add(value);
}
}
} else {
for (Iterator<?> v = valuesList.basicIterator(); v.hasNext(); ) {
value = v.next();
if (isIncluded(value)) {
values.add(value);
}
}
}
} else if (isIncluded(value)) {
values.add(value);
}
}
}
}
return values.size();
}
return 0;
}
use of org.eclipse.emf.ecore.util.FeatureMap in project statecharts by Yakindu.
the class DerivedEObjectEList method contains.
@Override
public boolean contains(Object object) {
if (sourceFeatureIDs != null) {
for (int i = 0; i < sourceFeatureIDs.length; i++) {
int sourceFeatureID = sourceFeatureIDs[i];
if (owner.eIsSet(sourceFeatureID)) {
EStructuralFeature sourceFeature = getEStructuralFeature(sourceFeatureID);
Object value = owner.eGet(sourceFeatureID, true, true);
if (FeatureMapUtil.isFeatureMap(sourceFeature)) {
FeatureMap featureMap = (FeatureMap) value;
for (int j = 0, size = featureMap.size(); j < size; j++) {
value = featureMap.getValue(j);
if (isIncluded(featureMap.getEStructuralFeature(j)) ? value == object : isIncluded(value) && derive(value) == object) {
return true;
}
}
} else if (isIncluded(sourceFeature)) {
if (sourceFeature.isMany() ? ((List<?>) value).contains(object) : value == object) {
return true;
}
} else {
if (sourceFeature.isMany()) {
InternalEList<?> valuesList = (InternalEList<?>) value;
if (valuesList instanceof RandomAccess) {
for (int j = 0, size = valuesList.size(); j < size; j++) {
value = valuesList.basicGet(j);
if (isIncluded(value) && derive(value) == object) {
return true;
}
}
} else {
for (Iterator<?> v = valuesList.basicIterator(); v.hasNext(); ) {
value = v.next();
if (isIncluded(value) && derive(value) == object) {
return true;
}
}
}
} else if (isIncluded(value) && derive(value) == object) {
return true;
}
}
}
}
}
return false;
}
Aggregations