// Path: cas-core/src/main/java/com/ghjansen/cas/core/ca/State.java
// public abstract class State {
// 
//     private String name;
//     private int value;
// 
//     protected State(String name, int value) {
//         if (name == null) {
//             throw new IllegalArgumentException();
//         }
//         this.name = name;
//         this.value = value;
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public int getValue() {
//         return this.value;
//     }
// 
// }
// 
// Path: cas-core/src/main/java/com/ghjansen/cas/core/ca/Transition.java
// public abstract class Transition<O extends Combination, A extends State> {
// 
//     private O combination;
//     private A state;
// 
//     protected Transition(O combination, A state) throws InvalidCombinationException, InvalidStateException {
//         if (combination == null) {
//             throw new InvalidCombinationException();
//         }
//         if (state == null) {
//             throw new InvalidStateException();
//         }
//         this.combination = combination;
//         this.state = state;
//     }
// 
//     public O getCombination() {
//         return this.combination;
//     }
// 
//     public A getState() {
//         return this.state;
//     }
// 
// }
// 
// Path: cas-core/src/main/java/com/ghjansen/cas/core/exception/InvalidStateException.java
// public class InvalidStateException extends Exception {
// 
//     /**
//      * Serialization management
//      */
//     private static final long serialVersionUID = -7435119307025647318L;
// 
// }
// 
// Path: cas-core/src/main/java/com/ghjansen/cas/core/exception/InvalidTransitionException.java
// public class InvalidTransitionException extends Exception {
// 
//     /**
//      * Serialization management
//      */
//     private static final long serialVersionUID = 1848434169756515614L;
// 
// }


import com.ghjansen.cas.core.ca.State;
import com.ghjansen.cas.core.ca.Transition;
import com.ghjansen.cas.core.exception.InvalidStateException;
import com.ghjansen.cas.core.exception.InvalidTransitionException;
/*
 * CAS - Cellular Automata Simulator
 * Copyright (C) 2016  Guilherme Humberto Jansen
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.ghjansen.cas.core.physics;


/**
 * @author Guilherme Humberto Jansen (contact.ghjansen@gmail.com)
 */
public abstract class Cell<A extends State, N extends Transition> {

    protected A state;
    protected N transition;

    protected Cell(N transition) throws InvalidTransitionException {
        if (transition == null) {
            throw new InvalidTransitionException();
        }
        this.transition = transition;
        this.state = (A) transition.getState();
    }

    protected Cell(A state) throws InvalidStateException {
        if (state == null) {
// Path: cas-core/src/main/java/com/ghjansen/cas/core/ca/State.java
// public abstract class State {
// 
//     private String name;
//     private int value;
// 
//     protected State(String name, int value) {
//         if (name == null) {
//             throw new IllegalArgumentException();
//         }
//         this.name = name;
//         this.value = value;
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public int getValue() {
//         return this.value;
//     }
// 
// }
// 
// Path: cas-core/src/main/java/com/ghjansen/cas/core/ca/Transition.java
// public abstract class Transition<O extends Combination, A extends State> {
// 
//     private O combination;
//     private A state;
// 
//     protected Transition(O combination, A state) throws InvalidCombinationException, InvalidStateException {
//         if (combination == null) {
//             throw new InvalidCombinationException();
//         }
//         if (state == null) {
//             throw new InvalidStateException();
//         }
//         this.combination = combination;
//         this.state = state;
//     }
// 
//     public O getCombination() {
//         return this.combination;
//     }
// 
//     public A getState() {
//         return this.state;
//     }
// 
// }
// 
// Path: cas-core/src/main/java/com/ghjansen/cas/core/exception/InvalidStateException.java
// public class InvalidStateException extends Exception {
// 
//     /**
//      * Serialization management
//      */
//     private static final long serialVersionUID = -7435119307025647318L;
// 
// }
// 
// Path: cas-core/src/main/java/com/ghjansen/cas/core/exception/InvalidTransitionException.java
// public class InvalidTransitionException extends Exception {
// 
//     /**
//      * Serialization management
//      */
//     private static final long serialVersionUID = 1848434169756515614L;
// 
// }


// Path: cas-core/src/main/java/com/ghjansen/cas/core/physics/Cell.java
import com.ghjansen.cas.core.ca.State;
import com.ghjansen.cas.core.ca.Transition;
import com.ghjansen.cas.core.exception.InvalidStateException;
import com.ghjansen.cas.core.exception.InvalidTransitionException;

/*
 * CAS - Cellular Automata Simulator
 * Copyright (C) 2016  Guilherme Humberto Jansen
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.ghjansen.cas.core.physics;


/**
 * @author Guilherme Humberto Jansen (contact.ghjansen@gmail.com)
 */
public abstract class Cell<A extends State, N extends Transition> {

    protected A state;
    protected N transition;

    protected Cell(N transition) throws InvalidTransitionException {
        if (transition == null) {
            throw new InvalidTransitionException();
        }
        this.transition = transition;
        this.state = (A) transition.getState();
    }

    protected Cell(A state) throws InvalidStateException {
        if (state == null) {
            throw new InvalidStateException();