use of eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell in project hale by halestudio.
the class AbstractBaseAlignmentLoader method applyModifiers.
/**
* Apply modifiers on the alignment.
*
* @param alignment the alignment to work on
* @param modifiers the modifiers to apply
* @param prefixMapping the mapping of prefixes (see
* {@link #getCell(Alignment, String, String, Map, IOReporter)})
* @param defaultPrefix the default prefix (may be <code>null</code>) (see
* {@link #getCell(Alignment, String, String, Map, IOReporter)})
* @param base whether the added modifiers are from a base alignment or the
* main alignment
* @param reporter the I/O reporter to report any errors to, may be
* <code>null</code>
*/
private void applyModifiers(Alignment alignment, Collection<M> modifiers, Map<String, String> prefixMapping, String defaultPrefix, boolean base, IOReporter reporter) {
for (M modifier : modifiers) {
Cell cell = getCell(alignment, getModifiedCell(modifier), defaultPrefix, prefixMapping, reporter);
if (cell == null)
continue;
// disabledFor
for (String disabledForId : getDisabledForList(modifier)) {
Cell other = getCell(alignment, disabledForId, defaultPrefix, prefixMapping, reporter);
if (other == null)
continue;
else if (!AlignmentUtil.isTypeCell(other)) {
reporter.warn(new IOMessageImpl("A cell referenced in disable-for is not a type cell.", null));
continue;
} else if (!alignment.getPropertyCells(other, true, false).contains(cell)) {
reporter.warn(new IOMessageImpl("A cell referenced in disable-for does not contain the cell that gets modified.", null));
continue;
}
// so it has to be a BaseAlignmentCell
if (base)
((BaseAlignmentCell) cell).setBaseDisabledFor(other, true);
else
((ModifiableCell) cell).setDisabledFor(other, true);
}
// transformation mode
TransformationMode mode = getTransformationMode(modifier);
if (mode != null) {
if (base)
((BaseAlignmentCell) cell).setBaseTransformationMode(mode);
else
((ModifiableCell) cell).setTransformationMode(mode);
}
// XXX handle additional properties
}
}
Aggregations