diff options
Diffstat (limited to 'l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java')
-rwxr-xr-x | l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java index cc362a96e740..d82390161ec2 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,7 +26,7 @@ ************************************************************************/ /* * Created on 2005 - * by Christian Schmidt + * by Christian Schmidt */ package com.sun.star.tooling.DirtyTags; @@ -41,7 +41,7 @@ import java.util.Iterator; */ public class TagPair { - + private Tag startTag=Tag.EMPTYTAG; private Tag endTag=Tag.EMPTYTAG; private String startingText=""; @@ -58,7 +58,7 @@ public class TagPair { /** * Create a new Instance of TagPairConstructionException - * + * * @param string */ public TagPairConstructionException(String string) { @@ -66,11 +66,11 @@ public class TagPair { } } - + /** * Create a new Instance of TagPair - * - * + * + * */ public TagPair() { @@ -79,14 +79,14 @@ public class TagPair { /** * Create a new Instance of TagPair - * - * Find matching tags in tagList, create a TagPair of it, create + * + * Find matching tags in tagList, create a TagPair of it, create * tagPairs from the content in the tagPair and remove all used - * tags from tagList. The rest of the tagList starts after the + * tags from tagList. The rest of the tagList starts after the * endTag of this TagPair. - * + * * @param tagList a List of the tags to check - * + * * @throws TagPairConstructionException */ public TagPair(ArrayList tagList) throws TagPairConstructionException { @@ -98,12 +98,12 @@ public class TagPair { Tag tag=(Tag)tagList.get(0); tagList.remove(0); - + if("Text".equals(tag.getTagType())){ - // is this Text the only content + // is this Text the only content // of this Tag ? if(tagList.size()==0){ - //yes...then it is the starting Text of this TagPair + //yes...then it is the starting Text of this TagPair this.startingText=tag.getTagString(); return; }else{ @@ -124,7 +124,7 @@ public class TagPair { //is this the end tag? if((tag=(Tag)iter.next()).getTagName().equals('/'+this.startTag.getTagName())&&equivalentTagCounter==0){ //found the corresponding end tag - + //this TagPair is complete //so it needs an id this.id=TagPair.ElementCounter++; @@ -135,8 +135,8 @@ public class TagPair { break; }else{ // tag is not the end tag - // so it is between the start and the end tag - // and belongs to the content + // so it is between the start and the end tag + // and belongs to the content // but first check if it has the same name as the current tag if(tag.getTagName().equals(this.startTag.getTagName())){ // if this is a start tag like the current start tag @@ -150,17 +150,17 @@ public class TagPair { equivalentTagCounter--; } } - + contentList.add(tag); } } //found the end tag ? //no... if (this.endTag.getTagType()==""){ - + throw new TagPairConstructionException("ERROR: Missing end tag ("+ this.startTag.getTagString()+")."); - //...yes + //...yes }else{ //We need to check whether the content is starting or ending with text //...check starting with text @@ -186,7 +186,7 @@ public class TagPair { this.endTag=new Tag("EndOfStandAlone","",""); createEnclosedTags(contentList); } - + } /** @@ -198,9 +198,9 @@ public class TagPair { //create the inner TagPairs this.enclosedTags.add(new TagPair(contentList)); } - + } - + public String toString(){ StringBuffer outString= new StringBuffer(this.startTag.toString()); TagPair help=new TagPair(); @@ -217,28 +217,28 @@ public class TagPair { outString.append(this.endTag.toString()); return new String(outString); } - + public String getWrapped() throws IOException{ Iterator iter=enclosedTags.iterator(); StringBuffer returnBuffer=new StringBuffer(); - + returnBuffer.append(wrap(this.startTag)+xmlString(this.startingText)); while(iter.hasNext()){ returnBuffer.append(((TagPair)iter.next()).getWrapped()); } returnBuffer.append(xmlString(this.endingText)+wrap(this.endTag)); - - - + + + return new String(returnBuffer); } - + private String wrap(Tag tag) throws IOException{ String string=""; //can be a start tag if(tag.getTagType().startsWith("Start")){ return new String("<bpt id='"+this.id+"'>"+tag.getWrappedTagString()+"</bpt>"); - //...or a end tag + //...or a end tag }else if (tag.getTagType().startsWith("End")){ //maybe the end tag of a Start and end tag // if("EndOfStandAlone".equals(tag.getTagType())){ @@ -247,7 +247,7 @@ public class TagPair { string=tag.getWrappedTagString(); return new String("<ept id='"+this.id+"'>"+string+"</ept>"); // } - + //...or text }else{ return xmlString(tag.getTagString()); @@ -255,7 +255,7 @@ public class TagPair { } /** * Replaces all characters that mustn't be in XLIFF PCdata - * + * * @param string the string to check * @return the checked string with all characters replaced * @throws java.io.IOException @@ -270,7 +270,7 @@ public class TagPair { str=str.substring(0, i)+"&"+str.substring(i+1); continue; } - + if(str.charAt(i)=='<'){ str=str.substring(0, i)+"<"+str.substring(i+1); continue; @@ -296,12 +296,12 @@ public class TagPair { } /** - * + * */ public static void resetCounter() { - TagPair.ElementCounter=1; - + TagPair.ElementCounter=1; + } - + } |