Commit d277cc47 authored by Farkas Ingrid's avatar Farkas Ingrid

added hasAttributes to the WithAttributesPath

Signed-off-by: Farkas Ingrid's avatarFarkas Ingrid <farkas94ingi@gmail.com>
parent b0985db9
......@@ -57,6 +57,7 @@ public final class WithAttributesPath implements ILocateableNode, IIncrementally
private List<SingleWithAttribute> realAttributeCache = new ArrayList<SingleWithAttribute>();
private boolean steppedOverEncode = false;
private boolean hadGlobalVariants = false;
/**
* Set the attributes handled by this with attribute path element.
......@@ -116,6 +117,15 @@ public final class WithAttributesPath implements ILocateableNode, IIncrementally
//Do nothing
}
public void setHadGlobalVariants(boolean has) {
hadGlobalVariants = has;
}
public boolean getHadGlobalVariants() {
return hadGlobalVariants;
}
/**
* Checks whether there is inconsistency among global attributes or not.
* Only the last encode can have effect this is because encode is not an
......@@ -532,6 +542,27 @@ public final class WithAttributesPath implements ILocateableNode, IIncrementally
return qualifierlessAttributeProcessor(timestamp);
}
public boolean hasAttributes(final CompilationTimeStamp timestamp)
{
if (hadGlobalVariants) {
return true;
}
if (getRealAttributes(timestamp).size() > 0) {
return true;
}
else if (attributes != null) {
for (int i = 0; i < attributes.getNofElements(); i++) {
Qualifiers qualifiers = attributes.getAttribute(i).getQualifiers();
if (qualifiers != null && qualifiers.getNofQualifiers() > 0) {
return true;
}
}
}
return false;
}
/**
* Handles the incremental parsing of this attribute set.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment