001/* 002 * Copyright (c) 2018 Chris K Wensel <chris@wensel.net>. All Rights Reserved. 003 * 004 * This Source Code Form is subject to the terms of the Mozilla Public 005 * License, v. 2.0. If a copy of the MPL was not distributed with this 006 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 007 */ 008 009package heretical.parser.common.util; 010 011import org.parboiled.support.Var; 012 013/** 014 * 015 */ 016public class DoubleVar extends Var<Double> 017 { 018 public DoubleVar() 019 { 020 } 021 022 public DoubleVar( Double number ) 023 { 024 super( number ); 025 } 026 027 public boolean set( String doubleString ) 028 { 029 doubleString = doubleString.replaceAll( ",", "" ); 030 031 try 032 { 033 return set( Double.valueOf( doubleString ) ); 034 } 035 catch( NumberFormatException exception ) 036 { 037 return false; 038 } 039 } 040 }