![JAR search and dependency download from the Maven repository](/logo.png)
org.ggp.base.util.propnet.architecture.components.Or Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alloy-ggp-base Show documentation
Show all versions of alloy-ggp-base Show documentation
A modified version of the GGP-Base library for Alloy.
The newest version!
package org.ggp.base.util.propnet.architecture.components;
import org.ggp.base.util.propnet.architecture.Component;
/**
* The Or class is designed to represent logical OR gates.
*/
@SuppressWarnings("serial")
public final class Or extends Component
{
/**
* Returns true if and only if at least one of the inputs to the or is true.
*
* @see org.ggp.base.util.propnet.architecture.Component#getValue()
*/
@Override
public boolean getValue()
{
for ( Component component : getInputs() )
{
if ( component.getValue() )
{
return true;
}
}
return false;
}
/**
* @see org.ggp.base.util.propnet.architecture.Component#toString()
*/
@Override
public String toString()
{
return toDot("ellipse", "grey", "OR");
}
@Override
public String getShortName() {
StringBuilder sb = new StringBuilder();
sb.append("or(");
for (Component component : getInputs()) {
sb.append(component.getShortName()).append(", ");
}
if (getInputs().size() > 0) {
sb.delete(sb.length() - 2, sb.length());
}
sb.append(")");
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy