Added addContent methods. Code review.
This commit is contained in:
parent
c5bd4b1261
commit
358beff8de
2 changed files with 38 additions and 16 deletions
|
@ -22,10 +22,10 @@ import java.util.Vector;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class TagDataListByIndex extends Vector<TagData> implements TagData
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 215545720925753884L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,11 +37,33 @@ public class TagDataManager
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public void appendAttribute(final String id, final int line, final String column, final String label, final String value)
|
||||
public void addContent(final String id, final long value)
|
||||
{
|
||||
SimpleTagData tag = this.getIdData(id, line, column);
|
||||
addContent(id, String.valueOf(value));
|
||||
}
|
||||
|
||||
tag.attributes().appendAttribute(label, value);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SimpleTagData addContent(final String id, final String content)
|
||||
{
|
||||
SimpleTagData result;
|
||||
|
||||
TagDataListByIndex tags = (TagDataListByIndex) this.idsDataById.getId(id);
|
||||
if (tags == null)
|
||||
{
|
||||
this.idsDataById.setId(id, new TagDataListByIndex());
|
||||
|
||||
tags = (TagDataListByIndex) this.idsDataById.getId(id);
|
||||
}
|
||||
|
||||
// Be sure that lines are existing.
|
||||
result = new SimpleTagData();
|
||||
result.setContent(content);
|
||||
tags.add(result);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,10 +158,10 @@ public class TagDataManager
|
|||
}
|
||||
|
||||
// Be sure that lines are existing.
|
||||
int nbLines = tags.size();
|
||||
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
||||
int lineCount = tags.size();
|
||||
for (int lineIndex = lineCount; lineIndex < line + 1; lineIndex++)
|
||||
{
|
||||
tags.add(nLine, new SimpleTagData());
|
||||
tags.add(lineIndex, new SimpleTagData());
|
||||
}
|
||||
|
||||
// Get item.
|
||||
|
@ -277,16 +299,16 @@ public class TagDataManager
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
public void setContent(final String id, final int line, final long value)
|
||||
{
|
||||
setContent(id, line, String.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
public void setContent(final String id, final int line, final String content)
|
||||
{
|
||||
SimpleTagData tag = this.getIdData(id, line);
|
||||
|
@ -305,16 +327,16 @@ public class TagDataManager
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
public void setContent(final String id, final int line, final String column, final long value)
|
||||
{
|
||||
setContent(id, line, column, String.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
public void setContent(final String id, final int line, final String column, final String content)
|
||||
{
|
||||
SimpleTagData tag = this.getIdData(id, line, column);
|
||||
|
|
Loading…
Reference in a new issue