001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krms.framework.engine;
017
018import java.util.Collections;
019import java.util.Map;
020
021/**
022 * PropositionResults are returned by {@link Proposition}'s evaluate method.
023 * @see Proposition evaluate
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026public class PropositionResult {
027
028        final boolean result;
029        Map<String,?> executionDetails;
030
031    /**
032     * Create a PropositionResult with the given result
033     * @param result to set the result to
034     */
035        public PropositionResult(boolean result) {
036            this(result, null);
037        }
038
039    /**
040     * Create a PropositionResult with the given values
041     * @param result to set the result to
042     * @param executionDetails to set executionDetails to
043     */
044        public PropositionResult(boolean result, Map<String,?> executionDetails) {
045                this.result = result;
046                
047                if (executionDetails == null) {
048                    this.executionDetails = Collections.emptyMap();
049                } else {
050                    this.executionDetails = Collections.unmodifiableMap(executionDetails);
051                }
052        }
053
054    /**
055     * Returns the result.
056     * @return the result
057     */
058        public boolean getResult() {
059                return result;
060        }
061
062    /**
063     * Returns the executionDetails
064     * @return the executionDetails
065     */
066        public Map<String,?> getExecutionDetails() {
067                return executionDetails;
068        }
069                
070}