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 without separators, where all words are in lower case
012 * @author Rusi Popov (popovr@mdatools.net)
013 */
014public class FormatAllLower extends FormatWordsString {
015
016  /**
017   * No separator between the words
018   */
019  public FormatAllLower() {
020    this( "" );
021  }
022
023  /**
024   * @see net.mdatools.modelant.core.operation.format.FormatWordsString#prepare(java.lang.String)
025   */
026  protected final String prepare(String source) {
027    return source;
028  }
029
030  /**
031   * @param separator non-null separator of the identified words
032   */
033  public FormatAllLower(String separator) {
034    super( separator );
035  }
036
037  /**
038   * @see net.mdatools.modelant.core.operation.format.FormatWordsString#formatFirstWord(java.lang.StringBuilder, java.lang.String, boolean)
039   */
040  protected final void formatFirstWord(StringBuilder result, String word, boolean nextWordExists) {
041    result.append( word.toLowerCase() );
042  }
043
044  /**
045   * @see net.mdatools.modelant.core.operation.format.FormatWordsString#formatNextWord(java.lang.StringBuilder, java.lang.String, boolean)
046   */
047  protected final void formatNextWord(StringBuilder result, String word, boolean nextWordExists) {
048    result.append( word.toLowerCase() );
049  }
050}