Clover coverage report - Code Coverage for hivemind release 1.1.1
Coverage timestamp: Sat Jan 28 2006 10:19:31 PST
file stats: LOC: 88   Methods: 5
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Token.java 100% 100% 100% 100%
coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.hivemind.conditional;
 16   
 17    import org.apache.hivemind.util.Defense;
 18   
 19    /**
 20    * A token recognized from a conditional expression.
 21    *
 22    * @author Howard M. Lewis Ship
 23    * @since 1.1
 24    */
 25    class Token
 26    {
 27    private TokenType _type;
 28   
 29    private String _value;
 30   
 31  8 Token(TokenType type)
 32    {
 33  8 this(type, null);
 34    }
 35   
 36    /**
 37    * @param type
 38    * a specific token type (may not be null)
 39    * @param value
 40    * the value for this token
 41    */
 42   
 43  24 Token(TokenType type, String value)
 44    {
 45  24 Defense.notNull(type, "type");
 46   
 47  24 _type = type;
 48  24 _value = value;
 49    }
 50   
 51  95 public TokenType getType()
 52    {
 53  95 return _type;
 54    }
 55   
 56    /**
 57    * Returns the specific value for this token, generally only meaningful for the
 58    * {@link org.apache.hivemind.conditional.TokenType#SYMBOL} type.
 59    */
 60   
 61  14 public String getValue()
 62    {
 63  14 return _value;
 64    }
 65   
 66    /**
 67    * Returns either <TYPE> or <TYPE(VALUE)>, where TYPE is the TokenType and VALUE is
 68    * the value (if non null).
 69    */
 70   
 71  5 public String toString()
 72    {
 73  5 StringBuffer buffer = new StringBuffer("<");
 74   
 75  5 buffer.append(_type);
 76   
 77  5 if (_value != null)
 78    {
 79  2 buffer.append("(");
 80  2 buffer.append(_value);
 81  2 buffer.append(")");
 82    }
 83   
 84  5 buffer.append(">");
 85   
 86  5 return buffer.toString();
 87    }
 88    }