diff options
Diffstat (limited to 'misc/xgen')
7 files changed, 69 insertions, 69 deletions
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/CacheGen.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/CacheGen.java index 3edf8b60..eb58fc25 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/CacheGen.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/CacheGen.java @@ -71,7 +71,7 @@ public abstract class CacheGen<G extends XGen<G>> { }
public void replay(State<Env> state, Trans trans,Writer w, String theme) throws IOException, APIException {
- if(thematic!=null) {
+ if (thematic!=null) {
theme = thematic.themeResolve(theme);
}
/* Theme
@@ -87,7 +87,7 @@ public abstract class CacheGen<G extends XGen<G>> { int i=0;
@SuppressWarnings("unchecked")
Section<G>[] reverse = new Section[sections.size()];
- for(Section<G> section : sections) {
+ for (Section<G> section : sections) {
s = section.use(state, trans, buff); // note, doesn't change cached, only dynamic, which is created for thread
int tempIndent = s.getIndent();
s.setIndent(indent);
@@ -97,7 +97,7 @@ public abstract class CacheGen<G extends XGen<G>> { reverse[i++]=s;
}
- for(--i;i>=0;--i) {
+ for (--i;i>=0;--i) {
reverse[i].back(w);
}
w.flush();
@@ -116,7 +116,7 @@ public abstract class CacheGen<G extends XGen<G>> { // Clone Dynamic to make Thread Safe
Dynamic d = new Dynamic(indent,code);
buff.setIndent(indent);
- if(code instanceof DynamicCode) {
+ if (code instanceof DynamicCode) {
buff.run(state,trans,Cache.Null.singleton(), (DynamicCode<G,?,? extends Trans>)code);
} else {
buff.run((Cache<G>)Cache.Null.singleton(), code);
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/XGen.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/XGen.java index 7b0a4263..b68ad6e5 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/XGen.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/XGen.java @@ -61,7 +61,7 @@ public class XGen<RT extends XGen<RT>> { }
protected void prettyln(PrintWriter pw) {
- if(pretty)pw.println();
+ if (pretty)pw.println();
}
public RT leaf(Mark mark, String tag, String ... args) {
@@ -110,10 +110,10 @@ public class XGen<RT extends XGen<RT>> { back.append(tag);
back.append('>');
- if(pretty) {
- if(mark!=null && mark.comment!=null) {
+ if (pretty) {
+ if (mark!=null && mark.comment!=null) {
int fi = forward.getIndent()*IndentPrintWriter.INDENT_MULTIPLIER;
- for(int i = fi+backSB.length();i<=COMMENT_COLUMN;++i) {
+ for (int i = fi+backSB.length();i<=COMMENT_COLUMN;++i) {
back.append(' ');
}
back.append("<!-- end ");
@@ -126,12 +126,12 @@ public class XGen<RT extends XGen<RT>> { forward.append(" -->");
}
forward.inc();
- if(!oneLine) {
+ if (!oneLine) {
forward.println();
}
back.println();
}
- if(mark!=null)mark.spot = backStack.size();
+ if (mark!=null)mark.spot = backStack.size();
backStack.push(new Back(backSB.toString(),true, false));
backSB.setLength(0);
return (RT)this;
@@ -143,7 +143,7 @@ public class XGen<RT extends XGen<RT>> { forward.append(tag);
addAttrs(attrs);
forward.append(" />");
- if(pretty) {
+ if (pretty) {
forward.println();
}
return (RT)this;
@@ -157,7 +157,7 @@ public class XGen<RT extends XGen<RT>> { @SuppressWarnings("unchecked")
public RT xml(String txt) {
- for(int i=0; i<txt.length();++i) {
+ for (int i=0; i<txt.length();++i) {
char c = txt.charAt(i);
switch(c) {
case '<':
@@ -179,11 +179,11 @@ public class XGen<RT extends XGen<RT>> { @SuppressWarnings("unchecked")
public RT textCR(int tabs, String txt) {
- for(int i=0;i<tabs;++i) {
+ for (int i=0;i<tabs;++i) {
forward.append(" ");
}
forward.append(txt);
- if(pretty)forward.println();
+ if (pretty)forward.println();
return (RT)this;
}
@@ -218,13 +218,13 @@ public class XGen<RT extends XGen<RT>> { int size = backStack.size();
Back c;
boolean println = false;
- for(int i=mark==null?0:mark.spot;i<size;++i) {
+ for (int i=mark==null?0:mark.spot;i<size;++i) {
c = backStack.pop();
- if(c.dec)forward.dec();
+ if (c.dec)forward.dec();
forward.append(c.str);
println = c.cr;
}
- if(pretty && println) {
+ if (pretty && println) {
forward.println();
}
return (RT)this;
@@ -233,14 +233,14 @@ public class XGen<RT extends XGen<RT>> { public RT end() {
Mark mark = new Mark();
mark.spot=backStack.size()-1;
- if(mark.spot<0)mark.spot=0;
+ if (mark.spot<0)mark.spot=0;
return end(mark);
}
public RT end(int i) {
Mark mark = new Mark();
mark.spot=backStack.size()-i;
- if(mark.spot<0)mark.spot=0;
+ if (mark.spot<0)mark.spot=0;
return end(mark);
}
@@ -250,9 +250,9 @@ public class XGen<RT extends XGen<RT>> { }
protected void addAttrs(String[] attrs) {
- if(attrs!=null) {
- for(String attr : attrs) {
- if(attr!=null && attr.length()>0) {
+ if (attrs!=null) {
+ for (String attr : attrs) {
+ if (attr!=null && attr.length()>0) {
forward.append(' ');
String[] split = attr.split("=",2);
switch(split.length) {
@@ -276,7 +276,7 @@ public class XGen<RT extends XGen<RT>> { @SuppressWarnings("unchecked")
public RT comment(String string) {
- if(pretty) {
+ if (pretty) {
forward.print("<!-- ");
forward.print(string);
forward.println(" -->");
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML4Gen.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML4Gen.java index 16ac60ae..846ab5a1 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML4Gen.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML4Gen.java @@ -121,13 +121,13 @@ public class HTML4Gen extends HTMLGen { // @Override
// protected void importCSS(Imports imports) {
-// if(imports.css.size()==1) {
+// if (imports.css.size()==1) {
// cssInline(imports.css.get(0));
// } else {
// text("<style type=\"text/css\">");
// prettyln(forward);
// forward.inc();
-// for(String str : imports.css) {
+// for (String str : imports.css) {
// forward.print("@import url(\"");
// forward.print(imports.themePath(null));
// forward.print(str);
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML5Gen.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML5Gen.java index 5e4cee7e..b502c6c6 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML5Gen.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML5Gen.java @@ -106,10 +106,10 @@ public class HTML5Gen extends HTMLGen { // @Override
// protected void importCSS(Imports imports) {
-// if(imports.css.size() == 1) {
+// if (imports.css.size() == 1) {
// cssInline(imports.css.get(0));
// } else {
-// for(String str : imports.css) {
+// for (String str : imports.css) {
// forward.print("<link rel=\"stylesheet\" href=\"");
// forward.print(imports.themePath(null));
// forward.print(str);
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTMLGen.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTMLGen.java index b2fb81d1..0db67913 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTMLGen.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTMLGen.java @@ -69,14 +69,14 @@ public abstract class HTMLGen extends XGen<HTMLGen> { public HTMLGen imports(Imports imports) {
//this.imports=imports;
- for(String str : imports.css) {
+ for (String str : imports.css) {
forward.print("<link rel=\"stylesheet\" href=\"");
forward.print(imports.themePath(null));
forward.print(str);
forward.println("\">");
}
- for(String str : imports.js) {
+ for (String str : imports.js) {
forward.print("<script type=\"text/javascript\" src=\"");
forward.print(imports.themePath(null));
forward.print(str);
@@ -87,8 +87,8 @@ public abstract class HTMLGen extends XGen<HTMLGen> { public HTMLGen jsVars(String ... attrs) {
forward.println("<script type=text/javascript>");
- if(attrs!=null) {
- for(int i=0; i<attrs.length;++i) {
+ if (attrs!=null) {
+ for (int i=0; i<attrs.length;++i) {
forward.append(' ');
String[] split = attrs[i].split("=",2);
switch(split.length) {
@@ -121,7 +121,7 @@ public abstract class HTMLGen extends XGen<HTMLGen> { forward.append(tag);
addAttrs(attrs);
forward.append('>');
- if(pretty) {
+ if (pretty) {
forward.println();
}
return this;
@@ -129,7 +129,7 @@ public abstract class HTMLGen extends XGen<HTMLGen> { public Mark divID(String ... attrs) {
Mark div;
- if(attrs.length>0) {
+ if (attrs.length>0) {
div = new Mark(attrs[0]);
attrs[0]="id="+attrs[0];
} else {
@@ -168,7 +168,7 @@ public abstract class HTMLGen extends XGen<HTMLGen> { nattrs[0]="id="+id;
nattrs[1]="name="+id;
System.arraycopy(attrs, 0, nattrs, 2, attrs.length);
- if(required) {
+ if (required) {
nattrs[nattrs.length-1]="required";
}
incr(mtd);
@@ -180,7 +180,7 @@ public abstract class HTMLGen extends XGen<HTMLGen> { // Common tags that do not have standard endings. These are here to help people who don't know to pick directive
public HTMLGen br() {
forward.append("<br>");
- if(pretty) {
+ if (pretty) {
forward.println();
}
return this;
@@ -188,10 +188,10 @@ public abstract class HTMLGen extends XGen<HTMLGen> { public HTMLGen p(String ... text) {
forward.append("<p>");
- for(String s : text) {
+ for (String s : text) {
forward.append(s);
}
- if(pretty) {
+ if (pretty) {
forward.println();
}
return this;
@@ -199,7 +199,7 @@ public abstract class HTMLGen extends XGen<HTMLGen> { public HTMLGen hr() {
forward.append("<hr>");
- if(pretty) {
+ if (pretty) {
forward.println();
}
return this;
@@ -221,7 +221,7 @@ public abstract class HTMLGen extends XGen<HTMLGen> { // try {
// forward.print("<style>");
// prettyln(forward);
-// while((line=br.readLine())!=null) {
+// while ((line=br.readLine())!=null) {
// forward.print((pretty?line:line.trim()));
// prettyln(forward);
// }
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/Imports.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/Imports.java index 00e7f30f..84e449b1 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/Imports.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/Imports.java @@ -62,9 +62,9 @@ public class Imports implements Thematic{ @Override
public String themePath(String theTheme) {
StringBuilder src = dots(new StringBuilder());
- if(theTheme==null||theTheme.length()==0) {
+ if (theTheme==null||theTheme.length()==0) {
src.append(theme);
- if(theme.length()>0)src.append('/');
+ if (theme.length()>0)src.append('/');
} else {
src.append(theTheme);
src.append('/');
@@ -87,7 +87,7 @@ public class Imports implements Thematic{ }
public StringBuilder dots(StringBuilder src) {
- for(int i=0;i<backdots;++i) {
+ for (int i=0;i<backdots;++i) {
src.append("../");
}
return src;
diff --git a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/JSGen.java b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/JSGen.java index 5d9a507d..a1f8f522 100644 --- a/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/JSGen.java +++ b/misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/JSGen.java @@ -49,27 +49,27 @@ public class JSGen { boolean pretty = htmlGen.pretty;
String line, el;
int l, end;
- while((line=br.readLine())!=null) {
- if(pretty) {
+ while ((line=br.readLine())!=null) {
+ if (pretty) {
String[] elements = line.split("\t");
- for(int i=0; i<elements.length;++i) {
+ for (int i=0; i<elements.length;++i) {
el = elements[i];
l = el.length();
- if(l==0) {// was a Tab
+ if (l==0) {// was a Tab
ipw.print(" ");
} else {
el = el.trim();
l = l-el.length();
end = l/tabstop;
- for(int j=0;j<end;++j) {
+ for (int j=0;j<end;++j) {
ipw.print(" ");
}
end = l%tabstop;
- for(int j=0;j<end;++j) {
+ for (int j=0;j<end;++j) {
ipw.print(' ');
}
- if(i>0) ipw.print(' ');
+ if (i>0) ipw.print(' ');
ipw.print(el);
}
}
@@ -94,40 +94,40 @@ public class JSGen { }
public JSGen pst(Mark jm, String ... lines) {
- if(lines.length>0) ipw.append(lines[0]);
+ if (lines.length>0) ipw.append(lines[0]);
ipw.append('(');
- for(int i=1;i<lines.length;++i) {
+ for (int i=1;i<lines.length;++i) {
ipw.print(lines[i]);
ipw.print(", ");
}
Back back;
- if(htmlGen.pretty) {
+ if (htmlGen.pretty) {
back = new Back(");\n",false,false);
} else {
back = new Back(");",false,false);
}
int spot = htmlGen.pushBack(back);
- if(jm!=null)jm.spot(spot);
+ if (jm!=null)jm.spot(spot);
return this;
}
public JSGen li(String ... lines) {
int current = ipw.getIndent();
- for(int i=0;i<lines.length;++i) {
- if(i==1)ipw.inc();
- if(i>0)ipw.println();
+ for (int i=0;i<lines.length;++i) {
+ if (i==1)ipw.inc();
+ if (i>0)ipw.println();
ipw.print(lines[i]);
}
ipw.setIndent(current);
ipw.append(';');
- if(htmlGen.pretty)ipw.println();
+ if (htmlGen.pretty)ipw.println();
return this;
}
public JSGen text(String text) {
ipw.append(text);
- if(htmlGen.pretty)ipw.println();
+ if (htmlGen.pretty)ipw.println();
return this;
}
@@ -144,17 +144,17 @@ public class JSGen { ipw.print("function ");
ipw.print(name);
ipw.print('(');
- for(int i=0;i<params.length;++i) {
- if(i!=0)ipw.print(", ");
+ for (int i=0;i<params.length;++i) {
+ if (i!=0)ipw.print(", ");
ipw.print(params[i]);
}
ipw.print(") {");
- if(htmlGen.pretty) {
+ if (htmlGen.pretty) {
ipw.println();
ipw.inc();
}
int spot = htmlGen.pushBack(new Back("}",true,true));
- if(jm!=null)jm.spot(spot);
+ if (jm!=null)jm.spot(spot);
return this;
}
@@ -164,27 +164,27 @@ public class JSGen { public JSGen cb(Mark jm, String ... lines) {
int current = ipw.getIndent();
- for(int i=0;i<lines.length;++i) {
- if(i==1)ipw.inc();
- if(i>0)ipw.println();
+ for (int i=0;i<lines.length;++i) {
+ if (i==1)ipw.inc();
+ if (i>0)ipw.println();
ipw.print(lines[i]);
}
ipw.setIndent(current);
ipw.print('{');
- if(htmlGen.pretty) {
+ if (htmlGen.pretty) {
ipw.println();
ipw.inc();
}
int spot = htmlGen.pushBack(new Back("}",true,true));
- if(jm!=null)jm.spot(spot);
+ if (jm!=null)jm.spot(spot);
return this;
}
public JSGen comment(String ... lines) {
- if(htmlGen.pretty) {
- for(int i=0;i<lines.length;++i) {
+ if (htmlGen.pretty) {
+ for (int i=0;i<lines.length;++i) {
ipw.print("// ");
ipw.println(lines[i]);
}
|