001/* 002 * Copyright c 2018 Rusi Popov, MDA Tools.net All rights reserved. 003 * 004 * This program and the accompanying materials are made available under the terms of the 005 * Eclipse Public License v2.0 which accompanies this distribution, and is available at 006 * http://www.eclipse.org/legal/epl-v20.html 007 */ 008package net.mdatools.modelant.core.operation.format; 009 010/** 011 * Concatenate the words separated by a space, where first one starts with upper case, any next one 012 * is in lower case 013 * @author Rusi Popov (popovr@mdatools.net) 014 */ 015public class FormatHumanReadable extends FormatWordsString { 016 017 public FormatHumanReadable() { 018 super( " " ); 019 } 020 021 /** 022 * @see net.mdatools.modelant.core.operation.format.FormatWordsString#prepare(java.lang.String) 023 */ 024 protected final String prepare(String source) { 025 return source; 026 } 027 028 /** 029 * @see net.mdatools.modelant.core.operation.format.FormatWordsString#formatFirstWord(java.lang.StringBuilder, java.lang.String, boolean) 030 */ 031 protected final void formatFirstWord(StringBuilder result, String word, boolean nextWordExists) { 032 formatFirstCapitalAllLower(result, word ); 033 } 034 035 /** 036 * @see net.mdatools.modelant.core.operation.format.FormatWordsString#formatNextWord(java.lang.StringBuilder, java.lang.String, boolean) 037 */ 038 protected final void formatNextWord(StringBuilder result, String word, boolean nextWordExists) { 039 result.append( word.toLowerCase() ); 040 } 041}