io.legaldocml.akn.element.ParliamentaryAnalysis Maven / Gradle / Ivy
The newest version!
package io.legaldocml.akn.element;
import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknObject;
import io.legaldocml.akn.util.AknList;
import io.legaldocml.akn.util.XmlReaderHelper;
import io.legaldocml.io.XmlReader;
import io.legaldocml.io.XmlWriter;
import java.io.IOException;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static io.legaldocml.akn.AknElements.QUORUM_VERIFICATION;
import static io.legaldocml.akn.AknElements.RECOUNT;
import static io.legaldocml.akn.AknElements.VOTING;
/**
* The complex type parliamentaryAnalysis is a list of all the parliamentary analysis elements that can be used on the
* analysis of a debate.
*
*
*
*
*
*
*
*
*
*
*
* @author Jacques Militello
*/
public abstract class ParliamentaryAnalysis implements AknObject {
private static final ImmutableMap> ELEMS;
static {
ELEMS = ImmutableMap.>builder()
.put(QUORUM_VERIFICATION, QuorumVerification::new)
.put(VOTING, Voting::new)
.put(RECOUNT, Recount::new)
.build();
}
// Mandatory (min 1).
private final AknList elements = new AknList<>(new ParliamentaryAnalysisElement[6]);
public Stream getElements() {
return this.elements.stream();
}
/**
* {@inheritDoc}
*/
@Override
public void write(XmlWriter writer) throws IOException {
this.elements.write(writer);
}
/**
* {@inheritDoc}
*/
@Override
public void read(XmlReader reader) {
XmlReaderHelper.read(reader, this.elements, ELEMS);
}
}