All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdc.util.enums.SynthesisStatus Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package cdc.util.enums;

import cdc.util.encoding.Encoded;
import cdc.util.encoding.Encoder;
import cdc.util.encoding.Encoders;

/**
 * Enumeration of synthesis statuses.
 * 

* This can be used to characterize data coming from different sources. * * @author Damien Carbonne * */ public enum SynthesisStatus implements Encoded { /** * No source is available. */ UNDEFINED('U'), /** * All sources agree to say that something is false. */ NONE('N'), /** * Some source agree to say that something is true, others that it is false. */ PARTIAL('P'), /** * All sources agree to say that something is true. */ ALL('A'); private final Character code; private SynthesisStatus(char code) { this.code = code; } public static final Encoder ENCODER = Encoders.encoder(SynthesisStatus.class, Character.class); @Override public Character getCode() { return code; } /** * Merges this status with another one. *

* The logic is: *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
UNPF
UUNPF
NNNPP
PPPPP
FFPPF
* * @param other The other synthesis status. * @return The merge of this status with {@code other}. */ public SynthesisStatus merge(SynthesisStatus other) { if (this == UNDEFINED) { return other; } else if (other == UNDEFINED) { return this; } else if (this == other) { return this; } else { return PARTIAL; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy