Coverage Report - org.jtheque.core.managers.state.AbstractState
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractState
0 %
0/13
0 %
0/2
1.143
 
 1  
 package org.jtheque.core.managers.state;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.utils.collections.CollectionUtils;
 20  
 
 21  
 import java.util.Collection;
 22  
 import java.util.HashMap;
 23  
 import java.util.Map;
 24  
 
 25  
 /**
 26  
  * An abstract state.
 27  
  *
 28  
  * @author Baptiste Wicht
 29  
  */
 30  0
 public abstract class AbstractState implements IState {
 31  0
     private final Map<String, String> properties = new HashMap<String, String>(10);
 32  
 
 33  
     @Override
 34  
     public final String getProperty(String key) {
 35  0
         return properties.get(key);
 36  
     }
 37  
 
 38  
     @Override
 39  
     public final String getProperty(String key, String defaults) {
 40  0
         String property = properties.get(key);
 41  
 
 42  0
         if (property == null) {
 43  0
             property = defaults;
 44  
         }
 45  
 
 46  0
         return property;
 47  
     }
 48  
 
 49  
     @Override
 50  
     public final void setProperty(String key, String value) {
 51  0
         properties.put(key, value);
 52  0
     }
 53  
 
 54  
     @Override
 55  
     public final Collection<String> getProperties() {
 56  0
         return CollectionUtils.copyOf(properties.keySet());
 57  
     }
 58  
 
 59  
     @Override
 60  
     public boolean isDelegated() {
 61  0
         return false;
 62  
     }
 63  
 
 64  
     @Override
 65  
     public Collection<NodeState> delegateSave() {
 66  0
         return null;
 67  
     }
 68  
 
 69  
     @Override
 70  
     public void delegateLoad(Collection<NodeState> nodes) {
 71  
         //Nothing by default
 72  0
     }
 73  
 }