blob: 78d8993e760efbef196c0703ce8d62fb47085de2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2019 Christian Pontesegger and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christian Pontesegger - initial API and implementation
*******************************************************************************/
package org.eclipse.ease.helpgenerator.model;
public class Description {
private final String fComment;
public Description(String comment) {
fComment = comment;
}
public String getComment() {
return fComment;
}
public String getFirstSentence() {
if (isEmpty())
return null;
int pos = getComment().indexOf(".");
while (pos > 0) {
final String sentence = getComment().substring(0, pos + 1);
if (sentence.split("\\{@").length == sentence.split("\\}").length)
return sentence;
pos = getComment().indexOf(".", pos + 1);
}
return getComment();
}
@Override
public String toString() {
return getComment();
}
public boolean isEmpty() {
return (getComment() == null) || getComment().isEmpty();
}
}