* the current realisation of the noun phrase.
*/
private static void realiseComplements(SyntaxProcessor parent,
PhraseElement phrase, ListElement realisedElement) {
ListElement indirects = new ListElement();
ListElement directs = new ListElement();
ListElement unknowns = new ListElement();
Object discourseValue = null;
NLGElement currentElement = null;
for (NLGElement complement : phrase
.getFeatureAsElementList(InternalFeature.COMPLEMENTS)) {
discourseValue = complement
.getFeature(InternalFeature.DISCOURSE_FUNCTION);
currentElement = parent.realise(complement);
if (currentElement != null) {
currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION,
DiscourseFunction.COMPLEMENT);
if (DiscourseFunction.INDIRECT_OBJECT.equals(discourseValue)) {
indirects.addComponent(currentElement);
} else if (DiscourseFunction.OBJECT.equals(discourseValue)) {
directs.addComponent(currentElement);
} else {
unknowns.addComponent(currentElement);
}
}
}
if (!InterrogativeType.isIndirectObject(phrase
.getFeature(Feature.INTERROGATIVE_TYPE))) {
realisedElement.addComponents(indirects.getChildren());
}
if (!phrase.getFeatureAsBoolean(Feature.PASSIVE).booleanValue()) {
if (!InterrogativeType.isObject(phrase
.getFeature(Feature.INTERROGATIVE_TYPE))) {
realisedElement.addComponents(directs.getChildren());
}
realisedElement.addComponents(unknowns.getChildren());
}
}