summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java16
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java10
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java38
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java36
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java56
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java16
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java6
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java2
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java20
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java14
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java6
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java18
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java12
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java6
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java22
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java2
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java2
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java24
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java120
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java52
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java2
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java4
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java52
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java2
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java60
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java2
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java36
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java24
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java22
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java2
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java16
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java16
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java22
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java12
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java14
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java2
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java12
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java4
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java2
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java2
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java22
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java6
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java4
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/CacheGen.java8
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/XGen.java38
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML4Gen.java4
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTML5Gen.java4
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/HTMLGen.java24
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/Imports.java6
-rw-r--r--misc/xgen/src/main/java/org/onap/aaf/misc/xgen/html/JSGen.java54
55 files changed, 495 insertions, 495 deletions
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java b/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java
index d72222e8..a8f0951e 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/BaseDataFactory.java
@@ -71,13 +71,13 @@ public class BaseDataFactory {
env.staticSlot(EnvFactory.SCHEMA_DIR),
EnvFactory.DEFAULT_SCHEMA_DIR);
File dir = new File(schemaDir);
- if(!dir.exists())throw new APIException("Schema Directory " + schemaDir + " does not exist. You can set this with " + EnvFactory.SCHEMA_DIR + " property");
+ if (!dir.exists())throw new APIException("Schema Directory " + schemaDir + " does not exist. You can set this with " + EnvFactory.SCHEMA_DIR + " property");
FileInputStream[] fis = new FileInputStream[filenames.length];
Source[] sources = new Source[filenames.length];
File f;
- for(int i=0; i<filenames.length; ++i) {
- if(!(f=new File(schemaDir + File.separatorChar + filenames[i])).exists()) {
- if(!f.exists()) throw new APIException("Cannot find " + f.getName() + " for schema validation");
+ for (int i=0; i<filenames.length; ++i) {
+ if (!(f=new File(schemaDir + File.separatorChar + filenames[i])).exists()) {
+ if (!f.exists()) throw new APIException("Cannot find " + f.getName() + " for schema validation");
}
try {
fis[i]=new FileInputStream(f);
@@ -95,7 +95,7 @@ public class BaseDataFactory {
} catch (SAXException e) {
throw new APIException(e);
} finally {
- for(FileInputStream d : fis) {
+ for (FileInputStream d : fis) {
try {
d.close();
} catch (IOException e) {
@@ -109,10 +109,10 @@ public class BaseDataFactory {
public static QName getQName(Class<?> clss) throws APIException {
// Obtain the Necessary info for QName from Requirement
XmlRootElement xre = clss.getAnnotation(XmlRootElement.class);
- if(xre==null)throw new APIException(clss.getName() + " does not have an XmlRootElement annotation");
+ if (xre==null)throw new APIException(clss.getName() + " does not have an XmlRootElement annotation");
Package pkg = clss.getPackage();
XmlSchema xs = pkg.getAnnotation(XmlSchema.class);
- if(xs==null) throw new APIException(clss.getName() + " package-info does not have an XmlSchema annotation");
+ if (xs==null) throw new APIException(clss.getName() + " package-info does not have an XmlSchema annotation");
return new QName(xs.namespace(),xre.name());
}
@@ -367,7 +367,7 @@ public class BaseDataFactory {
// */
// public Character objectify(Env env, String input) throws APIException {
// int length = input.length();
-// if(length<1 || length>1) {
+// if (length<1 || length>1) {
// throw new APIException("String [" + input + "] does not represent a single Character");
// }
// return input.charAt(0);
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java
index aa74edc9..f2b539a3 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java
@@ -68,8 +68,8 @@ public interface LogTarget {
PrintStream out = System.out;
out.print(org.onap.aaf.misc.env.util.Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
- if(str!=null) {
+ for (Object str : msgs) {
+ if (str!=null) {
out.print(str.toString());
out.print(' ');
} else {
@@ -83,7 +83,7 @@ public interface LogTarget {
PrintStream out = System.out;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
+ for (Object str : msgs) {
out.print(str.toString());
out.print(' ');
}
@@ -108,7 +108,7 @@ public interface LogTarget {
PrintStream out = System.err;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
+ for (Object str : msgs) {
out.print(str.toString());
out.print(' ');
}
@@ -120,7 +120,7 @@ public interface LogTarget {
PrintStream out = System.err;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
- for(Object str : msgs) {
+ for (Object str : msgs) {
out.print(str.toString());
out.print(' ');
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java b/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java
index b8a8e03a..6848be09 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/StoreImpl.java
@@ -81,15 +81,15 @@ public class StoreImpl implements Store {
staticMap = new HashMap<>();
localMap = new HashMap<>();
- if(tag!=null) {
+ if (tag!=null) {
String tequals = tag + '=';
- for(String arg : args) {
- if(arg.startsWith(tequals) && !arg.equals(tequals)) { // needs to have something after =
+ for (String arg : args) {
+ if (arg.startsWith(tequals) && !arg.equals(tequals)) { // needs to have something after =
Properties props = new Properties();
- for(String f : Split.split(File.pathSeparatorChar,arg.substring(tequals.length()))) {
+ for (String f : Split.split(File.pathSeparatorChar,arg.substring(tequals.length()))) {
moreProps(new File(f),props);
}
- for(Entry<Object, Object> es : props.entrySet()) {
+ for (Entry<Object, Object> es : props.entrySet()) {
put(staticSlot(es.getKey().toString()),es.getValue());
}
}
@@ -105,29 +105,29 @@ public class StoreImpl implements Store {
staticMap = new HashMap<>();
localMap = new HashMap<>();
- if(tag!=null) {
+ if (tag!=null) {
String fname = props.getProperty(tag);
- if(fname!=null) {
- for(String f : Split.split(File.pathSeparatorChar,fname)) {
- if(!moreProps(new File(f),props)) {
+ if (fname!=null) {
+ for (String f : Split.split(File.pathSeparatorChar,fname)) {
+ if (!moreProps(new File(f),props)) {
System.err.println("Unable to load Properties from " + f);
}
}
}
}
- for(Entry<Object, Object> es : props.entrySet()) {
+ for (Entry<Object, Object> es : props.entrySet()) {
put(staticSlot(es.getKey().toString()),es.getValue());
}
}
public void propsFromArgs(String tag, String[] args) {
- if(tag!=null) {
- for(String arg : args) {
+ if (tag!=null) {
+ for (String arg : args) {
String sarg[] = Split.split('=',arg);
- if(sarg.length==2) {
- if(tag.equals(sarg[0])) {
- for(String fname : Split.split(File.pathSeparatorChar,sarg[1])) {
+ if (sarg.length==2) {
+ if (tag.equals(sarg[0])) {
+ for (String fname : Split.split(File.pathSeparatorChar,sarg[1])) {
moreProps(new File(fname),null /* no target */);
}
}
@@ -138,22 +138,22 @@ public class StoreImpl implements Store {
}
private boolean moreProps(File f, Properties target) {
- if(f.exists()) {
+ if (f.exists()) {
Properties props = new Properties();
try {
FileInputStream fis = new FileInputStream(f);
try {
props.load(fis);
- if(target!=null) {
+ if (target!=null) {
target.load(fis);
}
} finally {
fis.close();
}
- } catch(IOException e) {
+ } catch (IOException e) {
System.err.println(e);
}
- for(Entry<Object, Object> es : props.entrySet()) {
+ for (Entry<Object, Object> es : props.entrySet()) {
put(staticSlot(es.getKey().toString()),es.getValue());
}
return true;
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java
index b86b4fbb..c0e7bde7 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java
@@ -124,7 +124,7 @@ public abstract class AbsTrans<ENV extends Env> implements TransStore {
Metric metric = new Metric();
int last = (metric.entries = trail.size()) -1;
metric.buckets = flags.length==0?EMPTYF:new float[flags.length];
- if(last>=0) {
+ if (last>=0) {
TimeTaken first = trail.get(0);
// If first entry is sub, then it's actually the last "end" as well
// otherwise, check end
@@ -133,48 +133,48 @@ public abstract class AbsTrans<ENV extends Env> implements TransStore {
metric.total = (end - first.start) / 1000000f;
}
- if(sb==null) {
- for(TimeTaken tt : trail) {
+ if (sb==null) {
+ for (TimeTaken tt : trail) {
float ms = tt.millis();
- for(int i=0;i<flags.length;++i) {
- if(tt.flag == flags[i]) metric.buckets[i]+=ms;
+ for (int i=0;i<flags.length;++i) {
+ if (tt.flag == flags[i]) metric.buckets[i]+=ms;
}
}
- } else if(!lt.isLoggable()) {
+ } else if (!lt.isLoggable()) {
boolean first = true;
- for(TimeTaken tt : trail) {
+ for (TimeTaken tt : trail) {
float ms = tt.millis();
- for(int i=0;i<flags.length;++i) {
- if(tt.flag == flags[i]) metric.buckets[i]+=ms;
+ for (int i=0;i<flags.length;++i) {
+ if (tt.flag == flags[i]) metric.buckets[i]+=ms;
}
- if((tt.flag&ALWAYS)==ALWAYS) {
- if(first) first = false;
+ if ((tt.flag&ALWAYS)==ALWAYS) {
+ if (first) first = false;
else sb.append('/');
sb.append(tt.name);
}
}
} else {
Stack<Long> stack = new Stack<Long>();
- for(TimeTaken tt : trail) {
+ for (TimeTaken tt : trail) {
// Create Indentation based on SUB
- while(!stack.isEmpty() && tt.end()>stack.peek()) {
+ while (!stack.isEmpty() && tt.end()>stack.peek()) {
--indent;
stack.pop();
}
- for(int i=0;i<indent;++i) {
+ for (int i=0;i<indent;++i) {
sb.append(" ");
}
tt.output(sb);
sb.append('\n');
- if((tt.flag&SUB)==SUB) {
+ if ((tt.flag&SUB)==SUB) {
stack.push(tt.end());
++indent;
}
// Add time values to Metric
float ms = tt.millis();
- for(int i=0;i<flags.length;++i) {
- if(tt.flag == flags[i]) metric.buckets[i]+=ms;
+ for (int i=0;i<flags.length;++i) {
+ if (tt.flag == flags[i]) metric.buckets[i]+=ms;
}
}
}
@@ -200,7 +200,7 @@ public abstract class AbsTrans<ENV extends Env> implements TransStore {
Object o;
try {
o = slot.get(state);
- } catch(ArrayIndexOutOfBoundsException e) {
+ } catch (ArrayIndexOutOfBoundsException e) {
// Env State Size has changed because of dynamic Object creation... Rare event, but needs to be covered
Object[] temp = ((StoreImpl) delegate).newTransState();
System.arraycopy(state, 0, temp, 0, state.length);
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java
index 94f7d47b..6fbfacdb 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/BasicEnv.java
@@ -86,9 +86,9 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
super(null, tags);
// props = new HashMap<>();
// String value;
-// for(int i=0;i<tags.length;++i) {
+// for (int i=0;i<tags.length;++i) {
// value = applet.getParameter(tags[i]);
-// if(value!=null) {
+// if (value!=null) {
// props.put(tags[i], value);
// }
// }
@@ -164,11 +164,11 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
case Env.REMOTE: sb.append("REMOTE "); break;
}
sb.append(name);
- if(flag != Env.CHECKPOINT) {
+ if (flag != Env.CHECKPOINT) {
sb.append(' ');
sb.append((end-start)/1000000f);
sb.append("ms");
- if(size>=0) {
+ if (size>=0) {
sb.append(" size: ");
sb.append(Long.toString(size));
}
@@ -185,11 +185,11 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
public Properties getProperties(String ... filter) {
Properties props = new Properties();
boolean yes;
- for(String key : existingStaticSlotNames()) {
- if(filter.length>0) {
+ for (String key : existingStaticSlotNames()) {
+ if (filter.length>0) {
yes = false;
- for(String f : filter) {
- if(key.startsWith(f)) {
+ for (String f : filter) {
+ if (key.startsWith(f)) {
yes = true;
break;
}
@@ -197,9 +197,9 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
} else {
yes = true;
}
- if(yes) {
+ if (yes) {
String value = getProperty(key);
- if(value!=null) {
+ if (value!=null) {
props.put(key, value);
}
}
@@ -242,7 +242,7 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
// @SuppressWarnings("unchecked")
// @Override
public <T> DataFactory<T> newDataFactory(Class<?>... classes) throws APIException {
-// if(String.class.isAssignableFrom(classes[0]))
+// if (String.class.isAssignableFrom(classes[0]))
// return (DataFactory<T>) new StringDF(this);
return new JAXBDF<T>(this,classes);
}
@@ -250,7 +250,7 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
// @SuppressWarnings("unchecked")
// @Override
public <T> DataFactory<T> newDataFactory(Schema schema, Class<?>... classes) throws APIException {
-// if(String.class.isAssignableFrom(classes[0]))
+// if (String.class.isAssignableFrom(classes[0]))
// return (DataFactory<T>) new StringDF(this);
return new JAXBDF<T>(this, schema, classes);
}
@@ -258,7 +258,7 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
// @SuppressWarnings("unchecked")
// @Override
public<T> DataFactory<T> newDataFactory(QName qName, Class<?> ... classes) throws APIException {
-// if(String.class.isAssignableFrom(classes[0]))
+// if (String.class.isAssignableFrom(classes[0]))
// return (DataFactory<T>) new StringDF(this);
return new JAXBDF<T>(this, qName, classes);
}
@@ -274,9 +274,9 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
}
public void loadFromSystemPropsStartsWith(String ... str) {
- for(String name : System.getProperties().stringPropertyNames()) {
- for(String s : str) {
- if(name.startsWith(s)) {
+ for (String name : System.getProperties().stringPropertyNames()) {
+ for (String s : str) {
+ if (name.startsWith(s)) {
setProperty(name, System.getProperty(name));
}
}
@@ -289,10 +289,10 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
*/
public void loadToSystemPropsStartsWith(String ... str) {
String value;
- for(String name : existingStaticSlotNames()) {
- for(String s : str) {
- if(name.startsWith(s)) {
- if((value = getProperty(name))!=null)
+ for (String name : existingStaticSlotNames()) {
+ for (String s : str) {
+ if (name.startsWith(s)) {
+ if ((value = getProperty(name))!=null)
System.setProperty(name,value);
}
}
@@ -301,24 +301,24 @@ public class BasicEnv extends StoreImpl implements EnvJAXB, TransCreate<TransJAX
public void loadPropFiles(String tag, ClassLoader classloader) throws IOException {
String propfiles = getProperty(tag);
- if(propfiles!=null) {
- for(String pf : Split.splitTrim(File.pathSeparatorChar, propfiles)) {
+ if (propfiles!=null) {
+ for (String pf : Split.splitTrim(File.pathSeparatorChar, propfiles)) {
InputStream is = classloader==null?null:classloader.getResourceAsStream(pf);
- if(is==null) {
+ if (is==null) {
File f = new File(pf);
- if(f.exists()) {
+ if (f.exists()) {
is = new FileInputStream(f);
}
}
- if(is!=null) {
+ if (is!=null) {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try {
String line;
- while((line=br.readLine())!=null) {
+ while ((line=br.readLine())!=null) {
line = line.trim();
- if(!line.startsWith("#")) {
+ if (!line.startsWith("#")) {
String[] tv = Split.splitTrim('=', line);
- if(tv.length==2) {
+ if (tv.length==2) {
setProperty(tv[0],tv[1]);
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java
index c8adfc78..3fcbcf9e 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/JavaUtilLogTarget.java
@@ -49,16 +49,16 @@ public class JavaUtilLogTarget implements LogTarget {
}
public void log(Object ... msgs) {
- if(log.isLoggable(level)) {
+ if (log.isLoggable(level)) {
StringBuilder sb = new StringBuilder();
String msg;
- for(int i=0;i<msgs.length;++i) {
+ for (int i=0;i<msgs.length;++i) {
msg = msgs[i].toString();
- if(msg!=null && msg.length()>0) {
+ if (msg!=null && msg.length()>0) {
int sbl = sb.length();
- if(sbl>0) {
+ if (sbl>0) {
char last = sb.charAt(sbl-1);
- if(" (.".indexOf(last)<0 && "().".indexOf(msg.charAt(0))<0)sb.append(' ');
+ if (" (.".indexOf(last)<0 && "().".indexOf(msg.charAt(0))<0)sb.append(' ');
}
sb.append(msg);
}
@@ -69,10 +69,10 @@ public class JavaUtilLogTarget implements LogTarget {
public void log(Throwable e, Object ... msgs) {
String str = e.getLocalizedMessage();
- if(str==null) {
+ if (str==null) {
str = e.getMessage();
}
- if(str==null) {
+ if (str==null) {
str = e.getClass().getName();
}
log.log(level,str,msgs);
@@ -83,7 +83,7 @@ public class JavaUtilLogTarget implements LogTarget {
*/
@Override
public void printf(String fmt, Object ... vars) {
- if(log.isLoggable(level)) {
+ if (log.isLoggable(level)) {
log.log(level,String.format(fmt,vars));
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java
index 81d9c1b2..b144852a 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/Log4JLogTarget.java
@@ -61,7 +61,7 @@ public class Log4JLogTarget implements LogTarget {
// @Override
public void log(Throwable e, Object... msgs) {
- if (log.isEnabledFor(level)) {
+ if (log.isEnabledFor (level)) {
StringBuilder sb = new StringBuilder();
String msg;
@@ -69,7 +69,7 @@ public class Log4JLogTarget implements LogTarget {
e.printStackTrace(new PrintWriter(new StringBuilderWriter(sb)));
}
for (int i = 0; i < msgs.length; ++i) {
- if(msgs[i]!=null) {
+ if (msgs[i]!=null) {
msg = msgs[i].toString();
if (msg != null && msg.length() > 0) {
int sbl = sb.length();
@@ -92,7 +92,7 @@ public class Log4JLogTarget implements LogTarget {
*/
@Override
public void printf(String fmt, Object ... vars) {
- if(log.isEnabledFor(level)) {
+ if (log.isEnabledFor (level)) {
log.log(level,String.format(fmt,vars));
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java
index dc7ee192..d140a6b8 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBDF.java
@@ -152,7 +152,7 @@ public class JAXBDF<T> extends BaseDataFactory implements OldDataFactory<T>,IOOb
try {
T t = jumar.unmarshal(env.debug(), input);
return new JAXBData<T>(primaryEnv, this, new JAXBStringifier<T>(jmar), new JAXBObjectifier<T>(jumar),t);
- } catch(JAXBException e) {
+ } catch (JAXBException e) {
throw new APIException(e);
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java
index 38977a35..6d83aca4 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBData.java
@@ -114,7 +114,7 @@ public final class JAXBData<T> implements Data<T>{
* @throws APIException
*/
public String asString(EnvJAXB env) throws APIException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
return dataAsString;
} else {
return dataAsString = stringifier.stringify(env, dataAsObject);
@@ -131,7 +131,7 @@ public final class JAXBData<T> implements Data<T>{
*/
// @Override
public String asString() throws APIException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
return dataAsString;
} else {
return dataAsString = stringifier.stringify(creatingEnv, dataAsObject,options);
@@ -139,7 +139,7 @@ public final class JAXBData<T> implements Data<T>{
}
public Data<T> to(OutputStream os) throws APIException, IOException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
os.write(dataAsString.getBytes());
} else if (stringifier instanceof IOStringifier){
((IOStringifier<T>)stringifier).stringify(creatingEnv, dataAsObject, os, options);
@@ -153,7 +153,7 @@ public final class JAXBData<T> implements Data<T>{
// @Override
public JAXBData<T> to(Writer writer) throws APIException, IOException {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
writer.write(dataAsString);
} else if (stringifier instanceof IOStringifier){
((IOStringifier<T>)stringifier).stringify(creatingEnv, dataAsObject, writer, options);
@@ -166,7 +166,7 @@ public final class JAXBData<T> implements Data<T>{
public InputStream getInputStream() throws APIException {
- if(dataAsString==null) {
+ if (dataAsString==null) {
dataAsString = stringifier.stringify(creatingEnv,dataAsObject,options);
}
return new ByteArrayInputStream(dataAsString.getBytes());
@@ -184,7 +184,7 @@ public final class JAXBData<T> implements Data<T>{
*/
public T asObject(EnvJAXB env) throws APIException {
- if(dataAsObject !=null) {
+ if (dataAsObject !=null) {
return dataAsObject;
} else {
// Some Java compilers need two statements here
@@ -204,7 +204,7 @@ public final class JAXBData<T> implements Data<T>{
*/
// @Override
public T asObject() throws APIException {
- if(dataAsObject !=null) {
+ if (dataAsObject !=null) {
return dataAsObject;
} else {
// Some Java compilers need two statements here
@@ -239,7 +239,7 @@ public final class JAXBData<T> implements Data<T>{
*/
// @Override
public String toString() {
- if(dataAsString!=null) {
+ if (dataAsString!=null) {
return dataAsString;
} else {
try {
@@ -292,8 +292,8 @@ public final class JAXBData<T> implements Data<T>{
int count;
do {
count = input.read(b);
- if(count>0)output.write(b, 0, count);
- } while(count>=0);
+ if (count>0)output.write(b, 0, count);
+ } while (count>=0);
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java
index 46c40ebb..524fc668 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBmar.java
@@ -80,10 +80,10 @@ public class JAXBmar {
}
public Marshaller get(boolean pretty, boolean fragment) throws JAXBException {
- if(pretty != p) {
+ if (pretty != p) {
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, p = pretty);
}
- if(fragment != f) {
+ if (fragment != f) {
m.setProperty(Marshaller.JAXB_FRAGMENT, f = fragment);
}
return m;
@@ -139,7 +139,7 @@ public class JAXBmar {
Pool<PMarshaller> mp;
synchronized(pools) {
mp = pools.get(classes);
- if(mp==null) {
+ if (mp==null) {
pools.put(classes,mp = new Pool<PMarshaller>(new Creator(classes)));
}
}
@@ -165,7 +165,7 @@ public class JAXBmar {
fragment = options.length>1?options[1]:this.fragment;
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, writer);
} else {
m.content.get(pretty,fragment).marshal(
@@ -185,7 +185,7 @@ public class JAXBmar {
fragment = options.length>1?options[1]:this.fragment;
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, os);
} else {
m.content.get(pretty,fragment).marshal(
@@ -200,7 +200,7 @@ public class JAXBmar {
public<O> O marshal(LogTarget lt, O o, Writer writer, Class<O> clss) throws JAXBException, APIException {
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, writer);
} else {
m.content.get(pretty,fragment).marshal(
@@ -216,7 +216,7 @@ public class JAXBmar {
public<O> O marshal(LogTarget lt, O o, OutputStream os, Class<O> clss) throws JAXBException, APIException {
Pooled<PMarshaller> m = mpool.get(lt);
try {
- if(qname==null) {
+ if (qname==null) {
m.content.get(pretty,fragment).marshal(o, os);
} else {
m.content.get(pretty,fragment).marshal(
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java
index fe3f0145..30345e7c 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/jaxb/JAXBumar.java
@@ -85,7 +85,7 @@ public class JAXBumar {
}
public Unmarshaller get(Schema schema) throws JAXBException {
- if(s != schema) {
+ if (s != schema) {
u.setSchema(s = schema);
}
return u;
@@ -135,7 +135,7 @@ public class JAXBumar {
Pool<SUnmarshaller> mp;
synchronized(pools) {
mp = pools.get(classes);
- if(mp==null) {
+ if (mp==null) {
pools.put(classes,mp = new Pool<SUnmarshaller>(new Creator(classes)));
}
}
@@ -174,7 +174,7 @@ public class JAXBumar {
@SuppressWarnings("unchecked")
public<O> O unmarshal(LogTarget env, String xml) throws JAXBException, APIException {
- if(xml==null) throw new JAXBException("Null Input for String unmarshal");
+ if (xml==null) throw new JAXBException("Null Input for String unmarshal");
Pooled<SUnmarshaller> s = mpool.get(env);
try {
return (O)s.content.get(schema).unmarshal(
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java
index ae78918c..553d7ade 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java
@@ -107,17 +107,17 @@ public class Chrono {
}
public static String utcStamp(Date date) {
- if(date==null)return "";
+ if (date==null)return "";
return utcFmt.format(date);
}
public static String utcStamp(GregorianCalendar gc) {
- if(gc==null)return "";
+ if (gc==null)return "";
return utcFmt.format(gc.getTime());
}
public static String utcStamp(XMLGregorianCalendar xgc) {
- if(xgc==null)return "";
+ if (xgc==null)return "";
return utcFmt.format(xgc.toGregorianCalendar().getTime());
}
@@ -126,17 +126,17 @@ public class Chrono {
}
public static String dateStamp(GregorianCalendar gc) {
- if(gc == null)return "";
+ if (gc == null)return "";
return dateFmt.format(gc.getTime());
}
public static String dateStamp(Date date) {
- if(date == null)return "";
+ if (date == null)return "";
return dateFmt.format(date);
}
public static String dateStamp(XMLGregorianCalendar xgc) {
- if(xgc==null)return "";
+ if (xgc==null)return "";
return dateFmt.format(xgc.toGregorianCalendar().getTime());
}
@@ -172,7 +172,7 @@ public class Chrono {
* @return
*/
public static String dateTime(GregorianCalendar gc) {
- if(gc == null)return "";
+ if (gc == null)return "";
TimeZone tz = gc.getTimeZone();
int tz1 = (tz.getRawOffset()+tz.getDSTSavings())/0x8CA0;
int tz1abs = Math.abs(tz1);
@@ -251,7 +251,7 @@ public class Chrono {
}
public static GregorianCalendar firstMomentOfDay(GregorianCalendar begin) {
- if(begin==null)begin = new GregorianCalendar();
+ if (begin==null)begin = new GregorianCalendar();
begin.set(GregorianCalendar.HOUR, 0);
begin.set(GregorianCalendar.AM_PM, GregorianCalendar.AM);
begin.set(GregorianCalendar.MINUTE, 0);
@@ -261,7 +261,7 @@ public class Chrono {
}
public static GregorianCalendar lastMomentOfDay(GregorianCalendar end) {
- if(end==null)end = new GregorianCalendar();
+ if (end==null)end = new GregorianCalendar();
end.set(GregorianCalendar.HOUR, 11);
end.set(GregorianCalendar.MINUTE, 59);
end.set(GregorianCalendar.SECOND, 59);
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java
index 97d9de99..b9191c00 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/DoubleOutputStream.java
@@ -43,7 +43,7 @@ public class DoubleOutputStream extends OutputStream {
*/
@Override
public void write(int c) throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.write(c);
}
}
@@ -58,14 +58,14 @@ public class DoubleOutputStream extends OutputStream {
*/
@Override
public void write(byte bbuf[], int off, int len) throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.write(bbuf,off,len);
}
}
@Override
public void write(byte[] b) throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.write(b);
}
}
@@ -75,8 +75,8 @@ public class DoubleOutputStream extends OutputStream {
*/
@Override
public void close() throws IOException {
- for(int i=0;i<oss.length;++i) {
- if(close[i]) {
+ for (int i=0;i<oss.length;++i) {
+ if (close[i]) {
oss[i].close();
}
}
@@ -87,7 +87,7 @@ public class DoubleOutputStream extends OutputStream {
*/
@Override
public void flush() throws IOException {
- for(OutputStream os : oss) {
+ for (OutputStream os : oss) {
os.flush();
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java
index 759a8c8b..3d6416cd 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/RefreshableThreadObject.java
@@ -87,7 +87,7 @@ public class RefreshableThreadObject<T extends Creatable<T>> {
public T get(Env env) throws APIException {
Thread t = Thread.currentThread();
T obj = objs.get(t);
- if(obj==null || refreshed>obj.created()) {
+ if (obj==null || refreshed>obj.created()) {
try {
obj = cnst.newInstance(new Object[]{env});
} catch (InvocationTargetException e) {
@@ -96,7 +96,7 @@ public class RefreshableThreadObject<T extends Creatable<T>> {
throw new APIException(e);
}
T destroyMe = objs.put(t,obj);
- if(destroyMe!=null) {
+ if (destroyMe!=null) {
destroyMe.destroy(env);
}
}
@@ -118,7 +118,7 @@ public class RefreshableThreadObject<T extends Creatable<T>> {
*/
public void remove(Env env) {
T obj = objs.remove(Thread.currentThread());
- if(obj!=null)
+ if (obj!=null)
obj.destroy(env);
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java
index 4069c329..b0da8ba2 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Split.java
@@ -33,20 +33,20 @@ public class Split {
private static final String[] BLANK = new String[0];
public static String[] split(char c, String value) {
- if(value==null) {
+ if (value==null) {
return BLANK;
}
// Count items to preallocate Array (memory alloc is more expensive than counting twice)
int count,idx;
- for(count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
+ for (count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
String[] rv = new String[count];
- if(count==1) {
+ if (count==1) {
rv[0]=value;
} else {
int last=0;
count=-1;
- for(idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
+ for (idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
rv[++count]=value.substring(last,idx);
last = ++idx;
}
@@ -56,19 +56,19 @@ public class Split {
}
public static String[] splitTrim(char c, String value) {
- if(value==null) {
+ if (value==null) {
return BLANK;
}
// Count items to preallocate Array (memory alloc is more expensive than counting twice)
int count,idx;
- for(count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
+ for (count=1,idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,++idx),++count);
String[] rv = new String[count];
- if(count==1) {
+ if (count==1) {
rv[0]=value.trim();
} else {
int last=0;
count=-1;
- for(idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
+ for (idx=value.indexOf(c);idx>=0;idx=value.indexOf(c,idx)) {
rv[++count]=value.substring(last,idx).trim();
last = ++idx;
}
@@ -78,19 +78,19 @@ public class Split {
}
public static String[] splitTrim(char c, String value, int size) {
- if(value==null) {
+ if (value==null) {
return BLANK;
}
int idx;
String[] rv = new String[size];
- if(size==1) {
+ if (size==1) {
rv[0]=value.trim();
} else {
int last=0;
int count=-1;
size-=2;
- for(idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
+ for (idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
rv[++count]=value.substring(last,idx).trim();
last = ++idx;
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java
index c512b09a..31d4bf3c 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/StringBuilderOutputStream.java
@@ -114,7 +114,7 @@ public class StringBuilderOutputStream extends OutputStream {
if (csq == null) {
write("null");
} else {
- for(int i = 0;i<csq.length();++i) {
+ for (int i = 0;i<csq.length();++i) {
buf.append(csq.charAt(i));
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
index 914a01b0..9feaf3ef 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
@@ -48,7 +48,7 @@ public class JU_Log4JLogTargetTest {
MockitoAnnotations.initMocks(this);
PowerMockito.mockStatic(Logger.class);
when(Logger.getLogger("Info")).thenReturn(log);
- when(log.isEnabledFor(Level.DEBUG)).thenReturn(false);
+ when(log.isEnabledFor (Level.DEBUG)).thenReturn(false);
}
@Test
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java
index 353261a0..582c750c 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java
@@ -32,7 +32,7 @@ public class InJson implements Parse<Reader, State> {
public Parsed<State> parse(Reader r, Parsed<State> parsed) throws ParseException {
// First things first, if there's a "leftover" event, process that immediately
State state = (State)parsed.state;
- if(state.unsent > 0) {
+ if (state.unsent > 0) {
parsed.event = state.unsent;
state.unsent = 0;
return parsed;
@@ -45,13 +45,13 @@ public class InJson implements Parse<Reader, State> {
boolean go = true;
try {
// Gather data from Reader, looking for special characters when not in Quotes
- while(go && (ch=r.read())>=0) {
- if(state.braces>=0 || ch==Parse.START_OBJ) { // ignore garbage/whitespace before content
+ while (go && (ch=r.read())>=0) {
+ if (state.braces>=0 || ch==Parse.START_OBJ) { // ignore garbage/whitespace before content
c=(char)ch;
// Character is a quote.
- if(c=='"') {
- if(inQuotes) {
- if(escaped) { // if escaped Quote, add to data.
+ if (c=='"') {
+ if (inQuotes) {
+ if (escaped) { // if escaped Quote, add to data.
sb.append(c);
escaped = false;
} else {
@@ -62,9 +62,9 @@ public class InJson implements Parse<Reader, State> {
inQuotes = true;
}
} else { // Not a Quote
- if(inQuotes) {
- if(c=='\\') {
- if(escaped) {
+ if (inQuotes) {
+ if (c=='\\') {
+ if (escaped) {
sb.append("\\\\");
escaped = false;
} else {
@@ -80,7 +80,7 @@ public class InJson implements Parse<Reader, State> {
parsed.isString = false;
break;
case Parse.START_OBJ:
- if(state.braces++ == 0) {
+ if (state.braces++ == 0) {
parsed.event = START_DOC;
state.unsent = c;
} else {
@@ -89,7 +89,7 @@ public class InJson implements Parse<Reader, State> {
go = false;
break;
case Parse.END_OBJ:
- if(--state.braces == 0) {
+ if (--state.braces == 0) {
parsed.event = c;
state.unsent = END_DOC;
} else {
@@ -99,7 +99,7 @@ public class InJson implements Parse<Reader, State> {
break;
// These three end the data gathering, and send it along with the event that is ending the data gathering
case Parse.NEXT:
- if(parsed.name.startsWith("__")) {
+ if (parsed.name.startsWith("__")) {
parsed.event = Parse.ATTRIB;
parsed.name = parsed.name.substring(2);
} else {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java
index 91b7c57d..175a2aa2 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java
@@ -51,13 +51,13 @@ public class InXML implements Parse<Reader, State> {
State state = parsed.state;
// OK, before anything else, see if there is leftover processing, if so, do it!
- if(state.unevaluated!=null) {
+ if (state.unevaluated!=null) {
DerTag dt = state.unevaluated;
state.unevaluated = null;
- if(!state.greatExp.eval(parsed, dt))return parsed;
+ if (!state.greatExp.eval(parsed, dt))return parsed;
}
- if(state.hasAttributes()) {
+ if (state.hasAttributes()) {
Prop prop = state.pop();
parsed.event = Parse.ATTRIB;
parsed.name = prop.tag;
@@ -73,14 +73,14 @@ public class InXML implements Parse<Reader, State> {
boolean go = true;
try {
- while(go && (ch=r.read())>=0) {
+ while (go && (ch=r.read())>=0) {
c = (char)ch;
- if(c == '"') {
- if(state.greatExp instanceof LeafExpectations) { // within a set of Tags, make a Quote
+ if (c == '"') {
+ if (state.greatExp instanceof LeafExpectations) { // within a set of Tags, make a Quote
sb.append(c);
} else {
- if(inQuotes) {
- if(escaped) {
+ if (inQuotes) {
+ if (escaped) {
sb.append('\\');
sb.append(c);
escaped = false;
@@ -92,11 +92,11 @@ public class InXML implements Parse<Reader, State> {
inQuotes = true;
}
}
- } else if(inQuotes) {
+ } else if (inQuotes) {
sb.append(c);
- } else if(c=='&') {
+ } else if (c=='&') {
XmlEscape.xmlEscape(sb,r);
- } else if(c=='\\') {
+ } else if (c=='\\') {
escaped=true;
} else {
switch(c) {
@@ -106,9 +106,9 @@ public class InXML implements Parse<Reader, State> {
break;
default:
// don't add Whitespace to start of SB... saves removing later
- if(sb.length()>0) {
+ if (sb.length()>0) {
sb.append(c);
- } else if(!Character.isWhitespace(c)) {
+ } else if (!Character.isWhitespace(c)) {
sb.append(c);
}
}
@@ -142,16 +142,16 @@ public class InXML implements Parse<Reader, State> {
String tag = null;
try {
- if((ch = r.read())<0) throw new ParseException("Reader content ended before complete");
- if(ch=='?') {
+ if ((ch = r.read())<0) throw new ParseException("Reader content ended before complete");
+ if (ch=='?') {
isXmlInfo = true;
}
// TODO Check for !-- comments
do {
c=(char)ch;
- if(c=='"') {
- if(inQuotes) {
- if(escaped) {
+ if (c=='"') {
+ if (inQuotes) {
+ if (escaped) {
sb.append(c);
escaped = false;
} else {
@@ -160,7 +160,7 @@ public class InXML implements Parse<Reader, State> {
} else {
inQuotes = true;
}
- } else if(inQuotes) {
+ } else if (inQuotes) {
sb.append(c);
} else {
switch(c) {
@@ -184,13 +184,13 @@ public class InXML implements Parse<Reader, State> {
// sb.setLength(0);
// break;
case '?':
- if(!isXmlInfo)sb.append(c);
+ if (!isXmlInfo)sb.append(c);
break;
default:
sb.append(c);
}
}
- } while(go && (ch=r.read())>=0);
+ } while (go && (ch=r.read())>=0);
} catch (IOException e) {
throw new ParseException(e);
}
@@ -198,14 +198,14 @@ public class InXML implements Parse<Reader, State> {
}
private void endField(String tag, StringBuilder sb) {
- if(name==null) {
+ if (name==null) {
name = sb.toString();
sb.setLength(0);
} else {
String value = sb.toString();
sb.setLength(0);
- if(tag !=null && value != null) {
- if(props==null)props = new ArrayList<>();
+ if (tag !=null && value != null) {
+ if (props==null)props = new ArrayList<>();
props.add(new Prop(tag,value));
}
}
@@ -217,7 +217,7 @@ public class InXML implements Parse<Reader, State> {
sb.append(" Tag\n");
sb.append(" Name: ");
sb.append(name);
- if(props!=null) for(Prop p : props) {
+ if (props!=null) for (Prop p : props) {
sb.append("\n ");
sb.append(p.tag);
sb.append("=\"");
@@ -250,7 +250,7 @@ public class InXML implements Parse<Reader, State> {
}
public void push(Prop prop) {
- if(attribs==null) {
+ if (attribs==null) {
attribs = new ArrayList<>();
idx = 0;
}
@@ -259,9 +259,9 @@ public class InXML implements Parse<Reader, State> {
public Prop pop() {
Prop rv = null;
- if(attribs!=null) {
+ if (attribs!=null) {
rv = attribs.get(idx++);
- if(idx>=attribs.size())attribs = null;
+ if (idx>=attribs.size())attribs = null;
}
return rv;
}
@@ -282,8 +282,8 @@ public class InXML implements Parse<Reader, State> {
// Recursively look back for any namespaces
protected Map<String,String> getNS() {
- if(ns!=null)return ns;
- if(prev!=null) {
+ if (ns!=null)return ns;
+ if (prev!=null) {
return prev.getNS();
}
return null;
@@ -291,47 +291,47 @@ public class InXML implements Parse<Reader, State> {
private void addNS(Prop prop) {
Map<String,String> existingNS = getNS();
- if(ns==null)ns = new HashMap<>();
+ if (ns==null)ns = new HashMap<>();
// First make a copy of previous NSs so that we have everything we need, but can overwrite, if necessary
- if(existingNS!=null && ns!=existingNS) {
+ if (existingNS!=null && ns!=existingNS) {
ns.putAll(ns);
}
ns.put(prop.tag, prop.value);
}
private JaxInfo getDerived(State state, JaxInfo ji, DerTag derTag) throws ParseException {
- if(derTag==null)return ji;
+ if (derTag==null)return ji;
List<Prop> props = derTag.props;
Prop derived = null;
- if(props!=null) {
+ if (props!=null) {
// Load Namespaces (if any)
- for(Prop prop : props) {
- if(prop.tag.startsWith("xmlns:")) {
+ for (Prop prop : props) {
+ if (prop.tag.startsWith("xmlns:")) {
addNS(prop);
}
}
- for(Prop prop : props) {
- if(prop.tag.endsWith(":type")) {
+ for (Prop prop : props) {
+ if (prop.tag.endsWith(":type")) {
int idx = prop.tag.indexOf(':');
String potentialNS = "xmlns:"+prop.tag.substring(0,idx);
Map<String,String> ns = getNS();
boolean noNamespace = false;
- if(ns==null) {
+ if (ns==null) {
noNamespace = true;
} else {
String nsVal = ns.get(potentialNS);
- if(nsVal==null) noNamespace = true;
+ if (nsVal==null) noNamespace = true;
else {
derived = new Prop(Parsed.EXTENSION_TAG,prop.value);
state.push(derived);
}
}
- if(noNamespace) {
+ if (noNamespace) {
throw new ParseException(prop.tag + " utilizes an invalid Namespace prefix");
}
- } else if(!prop.tag.startsWith("xmlns")) {
+ } else if (!prop.tag.startsWith("xmlns")) {
state.push(prop);
}
}
@@ -348,10 +348,10 @@ public class InXML implements Parse<Reader, State> {
// @Override
public boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException {
- if(derTag.isXmlInfo) {
+ if (derTag.isXmlInfo) {
parsed.event = START_DOC;
- } else if(ji.name.equals(derTag.name)) {
- if(derTag.isEndTag) {
+ } else if (ji.name.equals(derTag.name)) {
+ if (derTag.isEndTag) {
parsed.event = END_DOC;
parsed.state.greatExp = prev;
} else {
@@ -374,22 +374,22 @@ public class InXML implements Parse<Reader, State> {
// @Override
public boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException {
- if(derTag.isEndTag && ji.name.equals(derTag.name)) {
+ if (derTag.isEndTag && ji.name.equals(derTag.name)) {
parsed.state.greatExp = prev;
parsed.event = END_OBJ;
- if(printName)parsed.name = ji.name;
+ if (printName)parsed.name = ji.name;
} else {
//Standard Members
- for(JaxInfo memb : ji.members) {
- if(memb.name.equals(derTag.name)) {
+ for (JaxInfo memb : ji.members) {
+ if (memb.name.equals(derTag.name)) {
parsed.name = memb.name;
- if(memb.isArray) {
+ if (memb.isArray) {
parsed.state.unevaluated = derTag; // evaluate within Array Context
parsed.event = START_ARRAY;
parsed.state.greatExp = new ArrayExpectations(parsed.state,memb,this);
return false;
- } else if(memb.isObject()) {
- if(derTag.isEndTag) {
+ } else if (memb.isObject()) {
+ if (derTag.isEndTag) {
throw new ParseException("Unexpected End Tag </" + derTag.name + '>');
} else {
parsed.event = START_OBJ;
@@ -398,7 +398,7 @@ public class InXML implements Parse<Reader, State> {
return false;
}
} else { // a leaf
- if(derTag.isEndTag) {
+ if (derTag.isEndTag) {
throw new ParseException("Misplaced End Tag </" + parsed.name + '>');
} else {
parsed.state.greatExp = new LeafExpectations(parsed.state,memb, this);
@@ -421,7 +421,7 @@ public class InXML implements Parse<Reader, State> {
// @Override
public boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException {
- if(ji.name.equals(derTag.name) && derTag.isEndTag) {
+ if (ji.name.equals(derTag.name) && derTag.isEndTag) {
parsed.event = NEXT;
parsed.isString = ji.isString;
parsed.state.greatExp = prev;
@@ -435,18 +435,18 @@ public class InXML implements Parse<Reader, State> {
private static class ArrayExpectations extends GreatExpectations {
public ArrayExpectations(State state, JaxInfo ji, GreatExpectations prev) throws ParseException {
super(state, ji, prev,null);
- if(state.arrayInfo==null)state.arrayInfo=new Stack<ArrayState>();
+ if (state.arrayInfo==null)state.arrayInfo=new Stack<ArrayState>();
state.arrayInfo.push(new ArrayState());
}
// @Override
public boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException {
- if(ji.name.equals(derTag.name) && !derTag.isEndTag) {
- if(ji.isObject()) {
- if(derTag.isEndTag) {
+ if (ji.name.equals(derTag.name) && !derTag.isEndTag) {
+ if (ji.isObject()) {
+ if (derTag.isEndTag) {
throw new ParseException("Unexpected End Tag </" + derTag.name + '>');
} else {
ArrayState ai = parsed.state.arrayInfo.peek();
- if(ai.firstObj || ai.didNext) {
+ if (ai.firstObj || ai.didNext) {
ai.firstObj = false;
ai.didNext = false;
parsed.event = START_OBJ;
@@ -459,7 +459,7 @@ public class InXML implements Parse<Reader, State> {
}
}
} else { // a leave
- if(derTag.isEndTag) {
+ if (derTag.isEndTag) {
throw new ParseException("Misplaced End Tag </" + parsed.name + '>');
} else {
parsed.state.greatExp = new LeafExpectations(parsed.state, ji, this);
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java
index edc5f787..d209f02f 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java
@@ -65,22 +65,22 @@ public class JaxInfo {
public int getType() {
- if(isArray)return ARRAY;
- else if(members!=null)return OBJECT;
+ if (isArray)return ARRAY;
+ else if (members!=null)return OBJECT;
return DATA;
}
public JaxInfo getDerived(String derivedName) {
JaxInfo derived;
// Lazy Instantiation
- if(extensions == null) {
+ if (extensions == null) {
extensions = new HashMap<>();
derived = null;
} else {
derived = extensions.get(derivedName);
}
- if(derived == null) {
+ if (derived == null) {
//TODO for the moment, Classes are in same package
Package pkg = clss.getPackage();
try {
@@ -95,8 +95,8 @@ public class JaxInfo {
}
public static JaxInfo get(JaxInfo[] fields, String name) {
- for(JaxInfo f : fields) {
- if(name.equals(f.name)) return f;
+ for (JaxInfo f : fields) {
+ if (name.equals(f.name)) return f;
}
return null;
}
@@ -128,7 +128,7 @@ public class JaxInfo {
*/
public static JaxInfo build(Class<?> cls, String ... rootNns) throws SecurityException, NoSuchFieldException, ClassNotFoundException, ParseException {
String defaultNS;
- if(rootNns.length>0 && rootNns[0]!=null) {
+ if (rootNns.length>0 && rootNns[0]!=null) {
defaultNS = rootNns[0];
} else {
Package pkg = cls.getPackage();
@@ -136,15 +136,15 @@ public class JaxInfo {
defaultNS = xs==null?"":xs.namespace();
}
String name;
- if(rootNns.length>1) {
+ if (rootNns.length>1) {
name = rootNns[1];
} else {
XmlRootElement xre = cls.getAnnotation(XmlRootElement.class);
- if(xre!=null) {
+ if (xre!=null) {
name = xre.name();
} else {
XmlType xt = cls.getAnnotation(XmlType.class);
- if(xt!=null) {
+ if (xt!=null) {
name=xt.name();
} else {
throw new ParseException("Need a JAXB Object with XmlRootElement, or stipulate in parms");
@@ -162,10 +162,10 @@ public class JaxInfo {
Class<?> cls = clazz;
// Build up Method names from JAXB Annotations
XmlType xt;
- while((xt = cls.getAnnotation(XmlType.class))!=null) {
- if(fields==null)fields = new ArrayList<>();
- for(String field : xt.propOrder()) {
- if("".equals(field)) break; // odd bug. "" returned when no fields exist, rather than empty array
+ while ((xt = cls.getAnnotation(XmlType.class))!=null) {
+ if (fields==null)fields = new ArrayList<>();
+ for (String field : xt.propOrder()) {
+ if ("".equals(field)) break; // odd bug. "" returned when no fields exist, rather than empty array
Field rf = cls.getDeclaredField(field);
Class<?> ft = rf.getType();
@@ -175,27 +175,27 @@ public class JaxInfo {
String namespace = defaultNS;
XmlElement xe = rf.getAnnotation(XmlElement.class);
- if(xe!=null) {
+ if (xe!=null) {
xmlName=xe.name();
required = xe.required();
nillable = false;
- if(DEFAULT.equals(xmlName)) {
+ if (DEFAULT.equals(xmlName)) {
xmlName = field;
}
namespace = xe.namespace();
- if(DEFAULT.equals(namespace)) {
+ if (DEFAULT.equals(namespace)) {
namespace = defaultNS;
}
}
// If object is a List, then it is possible multiple, per XML/JAXB evaluation
- if(ft.isAssignableFrom(List.class)) {
+ if (ft.isAssignableFrom(List.class)) {
Type t = rf.getGenericType();
String classname = t.toString();
int start = classname.indexOf('<');
int end = classname.indexOf('>');
Class<?> genClass = Class.forName(classname.substring(start+1, end));
xe = genClass.getAnnotation(XmlElement.class);
- if(xe!=null && !DEFAULT.equals(xe.namespace())) {
+ if (xe!=null && !DEFAULT.equals(xe.namespace())) {
namespace = xe.namespace();
}
// add recursed recursed member, marked as array
@@ -208,7 +208,7 @@ public class JaxInfo {
}
cls = cls.getSuperclass();
};
- if(fields!=null) {
+ if (fields!=null) {
JaxInfo[] rv = new JaxInfo[fields.size()];
fields.toArray(rv);
return rv;
@@ -219,17 +219,17 @@ public class JaxInfo {
public StringBuilder dump(StringBuilder sb, int idx) {
- for(int i=0;i<idx;++i)sb.append(' ');
+ for (int i=0;i<idx;++i)sb.append(' ');
sb.append("Field ");
sb.append(name);
sb.append(" [");
sb.append(clss.getName());
sb.append("] ");
- if(isArray)sb.append(" (array)");
- if(required)sb.append(" (required)");
- if(nillable)sb.append(" (nillable)");
- if(members!=null) {
- for(JaxInfo f : members) {
+ if (isArray)sb.append(" (array)");
+ if (required)sb.append(" (required)");
+ if (nillable)sb.append(" (nillable)");
+ if (members!=null) {
+ for (JaxInfo f : members) {
sb.append('\n');
f.dump(sb,idx+2);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java
index 6a779fb8..2d7af059 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java
@@ -45,11 +45,11 @@ public class JaxSet<T> {
members = new TreeMap<>();
XmlType xmltype = cls.getAnnotation(XmlType.class);
Class<?> paramType[] = new Class[] {String.class};
- for(String str : xmltype.propOrder()) {
+ for (String str : xmltype.propOrder()) {
try {
String setName = "set" + Character.toUpperCase(str.charAt(0)) + str.subSequence(1, str.length());
Method meth = cls.getMethod(setName,paramType );
- if(meth!=null) {
+ if (meth!=null) {
members.put(str, new Setter<T>(meth) {
public void set(T o, Object t) throws ParseException {
try {
@@ -78,7 +78,7 @@ public class JaxSet<T> {
synchronized(jsets) {
@SuppressWarnings("unchecked")
JaxSet<X> js = (JaxSet<X>)jsets.get(cls);
- if(js == null) {
+ if (js == null) {
jsets.put(cls, js = new JaxSet<>(cls));
}
return js;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java
index 5e03ac91..6ff627b9 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java
@@ -55,7 +55,7 @@ public class Ladder<T> {
public void top() {
rung = struts.length-1;
- while(rung>0 && struts[rung]==null)--rung;
+ while (rung>0 && struts[rung]==null)--rung;
}
public int howHigh() {
@@ -63,7 +63,7 @@ public class Ladder<T> {
}
public void jumpTo(int rung) {
- if(rung>=struts.length) {
+ if (rung>=struts.length) {
Object[] temp = new Object[init_size*((rung/init_size)+1)];
System.arraycopy(struts, 0, temp, 0, struts.length);
struts = temp;
@@ -83,7 +83,7 @@ public class Ladder<T> {
public void ascend() {
++rung;
- if(rung>=struts.length) {
+ if (rung>=struts.length) {
Object[] temp = new Object[struts.length+init_size];
System.arraycopy(struts, 0, temp, 0, struts.length);
struts = temp;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java
index 4b8d2bf3..3729d1e3 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java
@@ -59,7 +59,7 @@ public abstract class Marshal<T> implements Parse<T, Marshal.State> {
@Override
public Void next() {
- if(!hasNext()) {
+ if (!hasNext()) {
throw new NoSuchElementException();
}
return null;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java
index 2716c8be..4fb52d86 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java
@@ -35,8 +35,8 @@ public class OutJax extends Out {
public <IN,S> void extract(IN in, Writer writer, Parse<IN, S> parse, boolean... options) throws IOException, ParseException {
Parsed<S> p = parse.newParsed();
JaxEval je = this.jaxEval;
- while((p = parse.parse(in,p.reuse())).valid()) {
- if(je==null)throw new ParseException("Incomplete content");
+ while ((p = parse.parse(in,p.reuse())).valid()) {
+ if (je==null)throw new ParseException("Incomplete content");
je = je.eval(p);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java
index d0a26784..6c868378 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java
@@ -33,7 +33,7 @@ public class OutJson extends Out {
public<IN,S> void extract(IN in, Writer writer, Parse<IN, S> prs, boolean ... options) throws IOException, ParseException {
Parsed<S> p = prs.newParsed();
IndentPrintWriter ipw;
- if(options.length>0 && options[0]) { // is Pretty
+ if (options.length>0 && options[0]) { // is Pretty
ipw = writer instanceof IndentPrintWriter?(IndentPrintWriter)writer:new IndentPrintWriter(writer);
writer = ipw;
} else {
@@ -47,13 +47,13 @@ public class OutJson extends Out {
char afterName=0, beforeName=0, maybe = 0, prev=0;
int count = 0;
- while((p = prs.parse(in,p.reuse())).valid()) {
+ while ((p = prs.parse(in,p.reuse())).valid()) {
++count;
switch(p.event) {
case 1:
continue;
case 2:
- if(count==2) { // it's empty, write open/close on it's own
+ if (count==2) { // it's empty, write open/close on it's own
writer.append('{');
writer.append('}');
}
@@ -61,7 +61,7 @@ public class OutJson extends Out {
return;
case '{':
afterName = '{';
- if(jsonLevel.peek().printObjectName) {
+ if (jsonLevel.peek().printObjectName) {
print = true;
} else { // don't print names on first
print=false;
@@ -70,7 +70,7 @@ public class OutJson extends Out {
jsonLevel.push(new LevelStack(true));
break;
case '}':
- if(p.hasData()) { // if we have data, we print that, so may need to prepend a comma.
+ if (p.hasData()) { // if we have data, we print that, so may need to prepend a comma.
maybe = jsonLevel.peek().listItem();
} else { // No data means just print,
p.name = ""; // XML tags come through with names, but no data
@@ -81,7 +81,7 @@ public class OutJson extends Out {
break;
case '[':
afterName = p.event;
- if((prev==',' && !hadData) || prev==']')maybe=',';
+ if ((prev==',' && !hadData) || prev==']')maybe=',';
else maybe = jsonLevel.peek().listItem();
jsonLevel.push(new LevelStack(false));
@@ -89,8 +89,8 @@ public class OutJson extends Out {
break;
case ']':
afterName = p.event;
- if(p.hasData()) {
- if(prev==',' && !hadData)maybe=',';
+ if (p.hasData()) {
+ if (prev==',' && !hadData)maybe=',';
else maybe = jsonLevel.peek().listItem();
} else {
p.name = ""; // XML tags come through with names, but no data
@@ -101,7 +101,7 @@ public class OutJson extends Out {
break;
case 3:
case ',':
- if(!p.hasData()) {
+ if (!p.hasData()) {
p.isString=false;
print=false;
} else {
@@ -113,36 +113,36 @@ public class OutJson extends Out {
print = true;
}
- if(maybe!=0) {
- if(ipw==null)writer.append(maybe);
+ if (maybe!=0) {
+ if (ipw==null)writer.append(maybe);
else ipw.println(maybe);
maybe = 0;
}
- if(beforeName!=0) {
- if(ipw==null)writer.append(beforeName);
+ if (beforeName!=0) {
+ if (ipw==null)writer.append(beforeName);
else ipw.println(beforeName);
beforeName = 0;
}
- if(print) {
- if(p.hasName()) {
+ if (print) {
+ if (p.hasName()) {
writer.append('"');
- if(p.event==3)writer.append("__");
+ if (p.event==3)writer.append("__");
writer.append(p.name);
writer.append("\":");
}
- if(p.hasData()) {
- if(p.isString) {
+ if (p.hasData()) {
+ if (p.isString) {
writer.append('"');
escapedWrite(writer, p.sb);
writer.append('"');
- } else if(p.sb.length()>0) {
+ } else if (p.sb.length()>0) {
writer.append(p.sb);
}
}
}
- if(afterName!=0) {
- if(ipw==null)writer.append(afterName);
+ if (afterName!=0) {
+ if (ipw==null)writer.append(afterName);
else {
switch(afterName) {
case '{':
@@ -155,7 +155,7 @@ public class OutJson extends Out {
ipw.print(afterName);
break;
case ']':
- if(prev=='}' || prev==',')ipw.println();
+ if (prev=='}' || prev==',')ipw.println();
ipw.dec();
ipw.print(afterName);
break;
@@ -170,7 +170,7 @@ public class OutJson extends Out {
afterName = 0;
}
- if(ipw!=null) {
+ if (ipw!=null) {
switch(p.event) {
case '[':
ipw.inc();
@@ -187,11 +187,11 @@ public class OutJson extends Out {
private void escapedWrite(Writer writer, StringBuilder sb) throws IOException {
char c;
- for(int i=0;i<sb.length();++i) {
+ for (int i=0;i<sb.length();++i) {
switch(c=sb.charAt(i)) {
case '\\':
writer.append(c);
- if(i<sb.length()) {
+ if (i<sb.length()) {
c=sb.charAt(++i);
writer.append(c);
}
@@ -221,7 +221,7 @@ public class OutJson extends Out {
}
public char listItem() {
- if(first_n_List) {
+ if (first_n_List) {
first_n_List=false;
return 0;
} else {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java
index babf53de..f07498b3 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java
@@ -30,7 +30,7 @@ public class OutRaw extends Out{
public<IN,S> void extract(IN in, Writer writer, Parse<IN,S> prs, boolean ... options) throws IOException, ParseException {
Parsed<S> p = prs.newParsed();
- while((p = prs.parse(in,p.reuse())).valid()) {
+ while ((p = prs.parse(in,p.reuse())).valid()) {
writer.append(p.toString());
writer.append('\n');
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java
index a887cb96..6472c88e 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java
@@ -43,9 +43,9 @@ public class OutXML extends Out{
public OutXML(String root, String ... params) {
this.root = root;
props = new ArrayList<>();
- for(String p : params) {
+ for (String p : params) {
String[] tv=p.split("=");
- if(tv.length==2)
+ if (tv.length==2)
props.add(new Prop(tv[0],tv[1]));
}
}
@@ -71,8 +71,8 @@ public class OutXML extends Out{
boolean pretty = (options.length>0&&options[0]);
IndentPrintWriter ipw;
- if(pretty) {
- if(writer instanceof IndentPrintWriter) {
+ if (pretty) {
+ if (writer instanceof IndentPrintWriter) {
ipw = (IndentPrintWriter)writer;
} else {
writer = ipw = new IndentPrintWriter(writer);
@@ -82,19 +82,19 @@ public class OutXML extends Out{
}
boolean closeTag = false;
Level level = new Level(null);
- while((p = prs.parse(in,p.reuse())).valid()) {
- if(!p.hasName() && level.multi!=null) {
+ while ((p = prs.parse(in,p.reuse())).valid()) {
+ if (!p.hasName() && level.multi!=null) {
p.name=level.multi;
}
- if(closeTag && p.event!=Parse.ATTRIB) {
+ if (closeTag && p.event!=Parse.ATTRIB) {
writer.append('>');
- if(pretty)writer.append('\n');
+ if (pretty)writer.append('\n');
closeTag = false;
}
switch(p.event) {
case Parse.START_DOC:
- if(!(options.length>1&&options[1])) // if not a fragment, print XML Info data
- if(pretty)ipw.println(XML_INFO);
+ if (!(options.length>1&&options[1])) // if not a fragment, print XML Info data
+ if (pretty)ipw.println(XML_INFO);
else writer.append(XML_INFO);
break;
case Parse.END_DOC:
@@ -102,21 +102,21 @@ public class OutXML extends Out{
case Parse.START_OBJ:
stack.push(level);
level = new Level(level);
- if(p.hasName()) {
+ if (p.hasName()) {
closeTag = tag(writer,level.sbw,pretty,pretty,p.name,null);
- } else if(root!=null && stack.size()==1) { // first Object
+ } else if (root!=null && stack.size()==1) { // first Object
closeTag = tag(writer,level.sbw,pretty,pretty,root,null);
// Write Root Props
- for(Prop prop : props) {
+ for (Prop prop : props) {
attrib(writer,pretty,prop.tag, prop.value,level);
}
}
- if(pretty)ipw.inc();
+ if (pretty)ipw.inc();
break;
case Parse.END_OBJ:
- if(p.hasData())
+ if (p.hasData())
closeTag = tag(writer,writer,pretty,false,p.name, XmlEscape.convert(p.sb));
- if(pretty)ipw.dec();
+ if (pretty)ipw.dec();
writer.append(level.sbw.getBuffer());
level = stack.pop();
break;
@@ -124,16 +124,16 @@ public class OutXML extends Out{
level.multi = p.name;
break;
case Parse.END_ARRAY:
- if(p.hasData())
+ if (p.hasData())
closeTag = tag(writer,writer,pretty,false, p.name, XmlEscape.convert(p.sb));
level.multi=null;
break;
case Parse.ATTRIB:
- if(p.hasData())
+ if (p.hasData())
attrib(writer,pretty,p.name, XmlEscape.convert(p.sb), level);
break;
case Parse.NEXT:
- if(p.hasData())
+ if (p.hasData())
closeTag = tag(writer,writer,pretty, false,p.name, XmlEscape.convert(p.sb));
break;
}
@@ -156,15 +156,15 @@ public class OutXML extends Out{
public boolean hasPrinted(String ns, String value, boolean create) {
boolean rv = false;
- if(nses==null) {
- if(prev!=null)rv = prev.hasPrinted(ns, value, false);
+ if (nses==null) {
+ if (prev!=null)rv = prev.hasPrinted(ns, value, false);
} else {
String v = nses.get(ns);
return value.equals(v); // note: accomodates not finding NS as well
}
- if(create && !rv) {
- if(nses == null) nses = new HashMap<>();
+ if (create && !rv) {
+ if (nses == null) nses = new HashMap<>();
nses.put(ns, value);
}
return rv;
@@ -177,25 +177,25 @@ public class OutXML extends Out{
private boolean tag(Writer fore, Writer aft, boolean pretty, boolean returns, String tag, String data) throws IOException {
fore.append('<');
fore.append(tag);
- if(data!=null) {
+ if (data!=null) {
fore.append('>'); // if no data, it may need some attributes...
fore.append(data);
- if(returns)fore.append('\n');
+ if (returns)fore.append('\n');
}
aft.append("</");
aft.append(tag);
aft.append(">");
- if(pretty)aft.append('\n');
+ if (pretty)aft.append('\n');
return data==null;
}
private void attrib(Writer fore, boolean pretty, String tag, String value, Level level) throws IOException {
String realTag = tag.startsWith("__")?tag.substring(2):tag; // remove __
- if(realTag.equals(Parsed.EXTENSION_TAG)) { // Convert Derived name into XML defined Inheritance
+ if (realTag.equals(Parsed.EXTENSION_TAG)) { // Convert Derived name into XML defined Inheritance
fore.append(" xsi:type=\"");
fore.append(value);
fore.append('"');
- if(!level.hasPrinted(XMLNS_XSI, XML_SCHEMA_INSTANCE,true)) {
+ if (!level.hasPrinted(XMLNS_XSI, XML_SCHEMA_INSTANCE,true)) {
fore.append(' ');
fore.append(XMLNS_XSI);
fore.append("=\"");
@@ -203,8 +203,8 @@ public class OutXML extends Out{
fore.append("\"");
}
} else {
- if(realTag.startsWith("xmlns:") ) {
- if(level.hasPrinted(realTag, value, true)) {
+ if (realTag.startsWith("xmlns:") ) {
+ if (level.hasPrinted(realTag, value, true)) {
return;
}
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java
index a4c679db..29a86de8 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java
@@ -73,15 +73,15 @@ public class Parsed<S> {
public String toString() {
StringBuilder sb2 = new StringBuilder();
- if(event<40)sb2.append((int)event);
+ if (event<40)sb2.append((int)event);
else sb2.append(event);
sb2.append(" - ");
sb2.append(name);
- if(sb.length()>0) {
+ if (sb.length()>0) {
sb2.append(" : ");
- if(isString)sb2.append('"');
+ if (isString)sb2.append('"');
sb2.append(sb);
- if(isString)sb2.append('"');
+ if (isString)sb2.append('"');
}
return sb2.toString();
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java
index ae9c8934..d46fc8be 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java
@@ -31,7 +31,7 @@ class Prop {
public Prop(String t_equals_v) {
String[] tv = t_equals_v.split("=");
- if(tv.length>1) {
+ if (tv.length>1) {
tag = tv[0];
value = tv[1];
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java
index a596b705..efb4ce4b 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java
@@ -50,20 +50,20 @@ public class Saved extends Out implements Parse<Reader, State>{
// @Override
public<IN,S> void extract(IN in, Writer ignore, Parse<IN,S> parser, boolean ... options) throws IOException, ParseException {
Parsed<S> p = parser.newParsed();
- if(!append) {
+ if (!append) {
// reuse array if not too big
- if(content==null||content.length>INIT_SIZE*3) {
+ if (content==null||content.length>INIT_SIZE*3) {
content = new Content[INIT_SIZE];
idx = -1;
} else do {
content[idx]=null;
- } while(--idx>=0);
+ } while (--idx>=0);
}
// Note: idx needs to be -1 on initialization and no appendages
- while((p = parser.parse(in,p.reuse())).valid()) {
- if(!(append && (p.event==START_DOC || p.event==END_DOC))) { // skip any start/end of document in appendages
- if(++idx>=content.length) {
+ while ((p = parser.parse(in,p.reuse())).valid()) {
+ if (!(append && (p.event==START_DOC || p.event==END_DOC))) { // skip any start/end of document in appendages
+ if (++idx>=content.length) {
Content temp[] = new Content[content.length*2];
System.arraycopy(content, 0, temp, 0, idx);
content = temp;
@@ -76,7 +76,7 @@ public class Saved extends Out implements Parse<Reader, State>{
// @Override
public Parsed<State> parse(Reader ignore, Parsed<State> parsed) throws ParseException {
int i;
- if((i=parsed.state.count++)<=idx)
+ if ((i=parsed.state.count++)<=idx)
content[i].load(parsed);
else
parsed.event = Parse.NONE;
@@ -85,9 +85,9 @@ public class Saved extends Out implements Parse<Reader, State>{
public Content[] cut(char event, int count) {
append = true;
- for(int i=idx;i>=0;--i) {
- if(content[i].event==event) count--;
- if(count==0) {
+ for (int i=idx;i>=0;--i) {
+ if (content[i].event==event) count--;
+ if (count==0) {
Content[] appended = new Content[idx-i+1];
System.arraycopy(content, i, appended, 0, appended.length);
idx = i-1;
@@ -98,8 +98,8 @@ public class Saved extends Out implements Parse<Reader, State>{
}
public void paste(Content[] appended) {
- if(appended!=null) {
- if(idx+appended.length>content.length) {
+ if (appended!=null) {
+ if (idx+appended.length>content.length) {
Content temp[] = new Content[content.length*2];
System.arraycopy(content, 0, temp, 0, idx);
content = temp;
@@ -134,7 +134,7 @@ public class Saved extends Out implements Parse<Reader, State>{
p.isString = isString;
p.event = event;
p.name = name;
- if(str!=null)
+ if (str!=null)
p.sb.append(str);
}
@@ -144,14 +144,14 @@ public class Saved extends Out implements Parse<Reader, State>{
sb.append(" - ");
sb.append(name);
sb.append(": ");
- if(isString)sb.append('"');
+ if (isString)sb.append('"');
sb.append(str);
- if(isString)sb.append('"');
+ if (isString)sb.append('"');
sb.append(' ');
- if(props!=null) {
+ if (props!=null) {
boolean comma = false;
- for(Prop prop : props) {
- if(comma)sb.append(',');
+ for (Prop prop : props) {
+ if (comma)sb.append(',');
else comma = true;
sb.append(prop.tag);
sb.append('=');
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java
index 1b0eec07..3007ea95 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java
@@ -36,13 +36,13 @@ public class XmlEscape {
try {
int c;
StringBuilder esc = new StringBuilder();
- for(int cnt = 0;cnt<9 /*max*/; ++cnt) {
- if((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
- if(c!=';') {
+ for (int cnt = 0;cnt<9 /*max*/; ++cnt) {
+ if ((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
+ if (c!=';') {
esc.append((char)c);
} else { // evaluate
Integer i = charMap.get(esc.toString());
- if(i==null) {
+ if (i==null) {
// leave in nasty XML format for now.
sb.append('&');
sb.append(esc);
@@ -69,20 +69,20 @@ public class XmlEscape {
public static String convert(StringBuilder insb) {
int idx, ch;
StringBuilder sb=null;
- for(idx=0;idx<insb.length();++idx) {
+ for (idx=0;idx<insb.length();++idx) {
ch = insb.charAt(idx);
- if(ch>=160 || ch==34 || ch==38 || ch==39 || ch==60 || ch==62) {
+ if (ch>=160 || ch==34 || ch==38 || ch==39 || ch==60 || ch==62) {
sb = new StringBuilder();
sb.append(insb,0,idx);
break;
}
}
- if(sb==null)return insb.toString();
+ if (sb==null)return insb.toString();
- for(int i=idx;i<insb.length();++i) {
+ for (int i=idx;i<insb.length();++i) {
ch = insb.charAt(i);
- if(ch<160) {
+ if (ch<160) {
switch(ch) {
case 34: sb.append("&quot;"); break;
case 38: sb.append("&amp;"); break;
@@ -94,7 +94,7 @@ public class XmlEscape {
}
} else { // use map
String s = intMap.get(ch);
- if(s==null)sb.append((char)ch);
+ if (s==null)sb.append((char)ch);
else {
sb.append('&');
sb.append(s);
@@ -362,8 +362,8 @@ public class XmlEscape {
charMap.put("hearts",9829);
charMap.put("diams",9830);
- for( Entry<String, Integer> es: charMap.entrySet()) {
- if(es.getValue()>=160); // save small space... note that no longer has amp, etc.
+ for ( Entry<String, Integer> es: charMap.entrySet()) {
+ if (es.getValue()>=160); // save small space... note that no longer has amp, etc.
intMap.put(es.getValue(), es.getKey());
}
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java
index 69926974..a95da8ea 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java
@@ -217,7 +217,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
* @return
*/
public RosettaDF<T> rootMarshal(Marshal<T> marshal) {
- if(marshal instanceof DocMarshal) {
+ if (marshal instanceof DocMarshal) {
this.marshal = marshal;
} else {
this.marshal = DocMarshal.root(marshal);
@@ -229,7 +229,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
Out out = getOut(outType);
TimeTaken tt = trans.start(out.logName(),logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(marshal==null) { // Unknown marshaller... do working XML marshal/extraction
+ if (marshal==null) { // Unknown marshaller... do working XML marshal/extraction
StringWriter sw = new StringWriter();
jaxMar.marshal(trans.debug(), t, sw, options);
out.extract(new StringReader(sw.toString()), new OutputStreamWriter(os), inXML,options);
@@ -247,7 +247,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
Out out = getOut(outType);
TimeTaken tt = trans.start(out.logName(),logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(marshal==null) { // Unknown marshaller... do working XML marshal/extraction
+ if (marshal==null) { // Unknown marshaller... do working XML marshal/extraction
StringWriter sw = new StringWriter();
jaxMar.marshal(trans.debug(), t, sw, options);
out.extract(new StringReader(sw.toString()), writer, inXML,options);
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
index 97f68dae..fa29dcdc 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
@@ -129,7 +129,7 @@ public class RosettaData<T> implements Data<T>{
Parse<?,?> in = df.getIn(inType);
TimeTaken tt = in.start(trans);
try {
- if(df.marshal==null) { // Unknown marshaller... do working XML marshal/extraction
+ if (df.marshal==null) { // Unknown marshaller... do working XML marshal/extraction
StringWriter sw = new StringWriter();
df.jaxMar.marshal(trans.debug(), t, sw, options);
saved.extract(new StringReader(xml = sw.toString()), (Writer)null, df.inXML);
@@ -169,15 +169,15 @@ public class RosettaData<T> implements Data<T>{
Out out = df.getOut(outType);
TimeTaken tt = trans.start(out.logName(),df.logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(outType==TYPE.XML) {
- if(xml==null) {
+ if (outType==TYPE.XML) {
+ if (xml==null) {
StringWriter sw = new StringWriter();
out.extract(null, sw, saved, options);
xml = sw.toString();
}
return xml;
} else { // is JSON
- if(json==null) {
+ if (json==null) {
StringWriter sw = new StringWriter();
out.extract(null, sw, saved, options);
json = sw.toString();
@@ -197,9 +197,9 @@ public class RosettaData<T> implements Data<T>{
Out out = df.getOut(outType);
TimeTaken tt = trans.start(out.logName(),df.logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(outType==TYPE.XML && xml!=null) {
+ if (outType==TYPE.XML && xml!=null) {
os.write(xml.getBytes());
- } else if(outType==TYPE.JSON && json!=null) {
+ } else if (outType==TYPE.JSON && json!=null) {
os.write(json.getBytes());
} else {
out.extract(null, os, saved, options);
@@ -217,9 +217,9 @@ public class RosettaData<T> implements Data<T>{
Out out = df.getOut(outType);
TimeTaken tt = trans.start(out.logName(),df.logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(outType==TYPE.XML && xml!=null) {
+ if (outType==TYPE.XML && xml!=null) {
writer.append(xml);
- } else if(outType==TYPE.JSON && json!=null) {
+ } else if (outType==TYPE.JSON && json!=null) {
writer.append(json);
} else {
out.extract(null, writer, saved, options);
@@ -260,7 +260,7 @@ public class RosettaData<T> implements Data<T>{
Out out = df.getOut(outType);
TimeTaken tt = trans.start(out.logName(),df.logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(df.marshal==null) { // Unknown marshaller... do working XML marshal/extraction
+ if (df.marshal==null) { // Unknown marshaller... do working XML marshal/extraction
StringWriter sw = new StringWriter();
df.jaxMar.marshal(trans.debug(), t, sw, options);
out.extract(new StringReader(xml = sw.toString()), writer, df.inXML,options);
@@ -278,8 +278,8 @@ public class RosettaData<T> implements Data<T>{
Out out = df.getOut(outType);
TimeTaken tt = trans.start(out.logName(),df.logType(outType)); // determine from Out.. without dependency on Env?
try {
- if(df.marshal==null) { // Unknown marshaller... do working XML marshal/extraction
- if(outType.equals(TYPE.XML)) {
+ if (df.marshal==null) { // Unknown marshaller... do working XML marshal/extraction
+ if (outType.equals(TYPE.XML)) {
df.jaxMar.marshal(trans.debug(), t, os, options);
} else {
StringWriter sw = new StringWriter();
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java
index 849a3214..0617e01d 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java
@@ -127,7 +127,7 @@ public abstract class DataWriter<T> {
// String in "HexString" or the processing in
// "String.format"
//sb.append("0x");
- for(int i=0;i<ba.length;++i) {
+ for (int i=0;i<ba.length;++i) {
byte b = ba[i];
sb.append(chars[((b&0xF0)>>4)]);
sb.append(chars[b&0xF]);
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java
index 6cabe068..1fa17010 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java
@@ -40,18 +40,18 @@ public class DocMarshal<T> extends Marshal<T> {
public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException {
Ladder<Iterator<?>> ladder = parsed.state.ladder;
Iterator<?> iter = ladder.peek();
- if(iter==null) {
+ if (iter==null) {
ladder.push(PENDING_ITERATOR);
parsed.event = START_DOC;
} else if (DONE_ITERATOR.equals(iter)) {
} else {
ladder.ascend(); // look at field info
Iterator<?> currFieldIter = ladder.peek();
- if(!DONE_ITERATOR.equals(currFieldIter)){
+ if (!DONE_ITERATOR.equals(currFieldIter)){
parsed = root.parse(t, parsed);
}
ladder.descend();
- if(DONE_ITERATOR.equals(currFieldIter) || parsed.event==NONE) {
+ if (DONE_ITERATOR.equals(currFieldIter) || parsed.event==NONE) {
parsed.event = END_DOC;
ladder.push(DONE_ITERATOR);
}
@@ -68,7 +68,7 @@ public class DocMarshal<T> extends Marshal<T> {
@Override
public Void next() {
- if(!hasNext()) {
+ if (!hasNext()) {
throw new NoSuchElementException();
}
return null;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java
index 48f3608d..abc19b26 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java
@@ -44,9 +44,9 @@ public abstract class FieldArray<T,S> extends Marshal<T> {
public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException {
Ladder<Iterator<?>> ladder = parsed.state.ladder;
Iterator<?> iter = ladder.peek();
- if(iter==null) {
+ if (iter==null) {
List<S> list = data(t);
- if(list.isEmpty() && parsed.state.smallest) {
+ if (list.isEmpty() && parsed.state.smallest) {
ladder.push(DONE_ITERATOR);
} else {
ladder.push(new ListIterator<S>(list));
@@ -59,24 +59,24 @@ public abstract class FieldArray<T,S> extends Marshal<T> {
Iterator<?> memIter = ladder.peek();
ListIterator<S> mems = (ListIterator<S>)iter;
S mem;
- if(memIter==null) {
+ if (memIter==null) {
mem=mems.next();
- } else if(!DONE_ITERATOR.equals(memIter)) {
+ } else if (!DONE_ITERATOR.equals(memIter)) {
mem=mems.peek();
- } else if(iter.hasNext()) {
+ } else if (iter.hasNext()) {
mem=null;
ladder.push(null);
} else {
mem=null;
}
- if(mem!=null) {
+ if (mem!=null) {
parsed.isString=dataWriter.write(mem, parsed.sb);
parsed.event = NEXT;
}
ladder.descend();
- if(mem==null) {
- if(iter.hasNext()) {
+ if (mem==null) {
+ if (iter.hasNext()) {
parsed.event = NEXT;
} else {
parsed.event = END_ARRAY;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java
index 384e0c98..9c64e83d 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java
@@ -44,9 +44,9 @@ public abstract class ObjArray<T,S> extends Marshal<T> {
public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException {
Ladder<Iterator<?>> ladder = parsed.state.ladder;
Iterator<?> iter = ladder.peek();
- if(iter==null) {
+ if (iter==null) {
List<S> list = data(t);
- if(list.isEmpty() && parsed.state.smallest) {
+ if (list.isEmpty() && parsed.state.smallest) {
ladder.push(DONE_ITERATOR);
} else {
ladder.push(new ListIterator<S>(list));
@@ -58,22 +58,22 @@ public abstract class ObjArray<T,S> extends Marshal<T> {
Iterator<?> memIter = ladder.peek();
ListIterator<S> mems = (ListIterator<S>)iter;
S mem;
- if(memIter==null) {
+ if (memIter==null) {
mem=mems.next();
- } else if(!DONE_ITERATOR.equals(memIter)) {
+ } else if (!DONE_ITERATOR.equals(memIter)) {
mem=mems.peek();
- } else if(iter.hasNext()) {
+ } else if (iter.hasNext()) {
mem=null;
ladder.push(null);
} else {
mem=null;
}
- if(mem!=null)
+ if (mem!=null)
parsed = subMarshaller.parse(mem, parsed);
ladder.descend();
- if(mem==null) {
- if(iter.hasNext()) {
+ if (mem==null) {
+ if (iter.hasNext()) {
parsed.event = NEXT;
} else {
parsed.event = END_ARRAY;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java
index 31e214b5..d96a44d0 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java
@@ -47,9 +47,9 @@ public abstract class ObjMarshal<T> extends Marshal<T> {
*/
@SuppressWarnings("unchecked")
protected void add(Marshal<T> pm) {
- if(pml==null) {
+ if (pml==null) {
pml = new Marshal[Ladder.DEFAULT_INIT_SIZE];
- } else if(end>pml.length) {
+ } else if (end>pml.length) {
Object temp[] = pml;
pml = new Marshal[pml.length+Ladder.DEFAULT_INIT_SIZE];
System.arraycopy(temp, 0, pml, 0, pml.length);
@@ -66,8 +66,8 @@ public abstract class ObjMarshal<T> extends Marshal<T> {
public Parsed<State> parse(T in, Parsed<State> parsed) throws ParseException {
Ladder<Iterator<?>> ladder = parsed.state.ladder;
Iterator<Marshal<T>> iter = (Iterator<Marshal<T>>)ladder.peek();
- if(iter==null) {
- if(pml.length>0) {
+ if (iter==null) {
+ if (pml.length>0) {
ladder.push(new FieldsIterator());
parsed.event = START_OBJ;
} else {
@@ -78,22 +78,22 @@ public abstract class ObjMarshal<T> extends Marshal<T> {
ladder.ascend(); // look at field info
Iterator<?> currFieldIter = ladder.peek();
Marshal<T> marshal;
- if(currFieldIter==null) {
+ if (currFieldIter==null) {
marshal=fields.next();
- } else if(!DONE_ITERATOR.equals(currFieldIter)) {
+ } else if (!DONE_ITERATOR.equals(currFieldIter)) {
marshal=fields.peek();
- if(marshal==null && fields.hasNext())marshal=fields.next();
- } else if(fields.hasNext()) {
+ if (marshal==null && fields.hasNext())marshal=fields.next();
+ } else if (fields.hasNext()) {
marshal=fields.next();
ladder.push(null);
} else {
marshal=null;
}
- if(marshal!=null)
+ if (marshal!=null)
parsed = marshal.parse(in, parsed);
ladder.descend();
- if(marshal==null || parsed.event==NONE) {
+ if (marshal==null || parsed.event==NONE) {
parsed.event = END_OBJ;
ladder.push(DONE_ITERATOR);
}
@@ -111,7 +111,7 @@ public abstract class ObjMarshal<T> extends Marshal<T> {
@Override
public Marshal<T> next() {
- if(!hasNext()) {
+ if (!hasNext()) {
throw new NoSuchElementException();
}
return pml[++idx];
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java
index 3e12f594..67565122 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java
@@ -90,7 +90,7 @@ public class JU_FromJSON {
tt.done();
}
report.glean(trans,Env.JSON);
- } while(report.go());
+ } while (report.go());
String result = sbw.toString();
System.out.println(result);
@@ -120,7 +120,7 @@ public class JU_FromJSON {
tt.done();
}
report.glean(trans,Env.JSON);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -147,7 +147,7 @@ public class JU_FromJSON {
tt.done();
}
report.glean(trans,Env.JSON);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -175,7 +175,7 @@ public class JU_FromJSON {
tt.done();
}
report.glean(trans,Env.JSON);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -218,7 +218,7 @@ public class JU_FromJSON {
tt.done();
}
report.glean(trans,Env.XML);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -260,7 +260,7 @@ public class JU_FromJSON {
tt.done();
}
report.glean(trans,Env.XML);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java
index 2a4e3d2d..4fefe622 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java
@@ -100,7 +100,7 @@ public class JU_FromXML {
tt.done();
}
report.glean(trans,Env.XML);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -127,7 +127,7 @@ public class JU_FromXML {
tt.done();
}
report.glean(trans,Env.XML);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -136,7 +136,7 @@ public class JU_FromXML {
@Test
public void warmup() throws Exception {
- if(ITERATIONS>20) {
+ if (ITERATIONS>20) {
System.out.println("*** Warmup JAXB ***");
JAXBumar jaxbUmar = new JAXBumar(LargerData.class);
@@ -170,7 +170,7 @@ public class JU_FromXML {
all.done();
}
report.glean(trans,Env.XML);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
@@ -209,7 +209,7 @@ public class JU_FromXML {
all.done();
}
report.glean(trans,Env.XML);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString()); }
@@ -225,7 +225,7 @@ public class JU_FromXML {
Trans trans = EnvFactory.newTrans();
LargerData ld;
- for(int i=0;i<ITERATIONS;++i) {
+ for (int i=0;i<ITERATIONS;++i) {
sbw.reset();
TimeTaken all = trans.start("Combo", Env.SUB);
try {
@@ -247,7 +247,7 @@ public class JU_FromXML {
}
sbw.append('\n');
Metric m;
- if(ITERATIONS>20) {
+ if (ITERATIONS>20) {
m = trans.auditTrail(0,null);
} else {
m = trans.auditTrail(0, sbw.getBuffer());
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java
index 9ab06e7c..af58ea57 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java
@@ -123,7 +123,7 @@ public class JU_JSON {
System.out.println(sw);
String result = sw.toString();
- if(!result.equals(cmp)) {
+ if (!result.equals(cmp)) {
sw.getBuffer().setLength(0);
new OutRaw().extract(new StringReader(str), sw, in);
System.out.println(sw);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java
index 229f1bf4..fd6142b1 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java
@@ -32,22 +32,22 @@ public class JU_Ladder {
public void test() {
Ladder<String> ladder = new Ladder<String>();
- for(int i=0;i<30;++i) {
- for(int j=0;j<i;++j)ladder.ascend();
+ for (int i=0;i<30;++i) {
+ for (int j=0;j<i;++j)ladder.ascend();
String str = "Rung " + i;
assertEquals(ladder.peek(),null);
ladder.push(str);
assertEquals(str,ladder.peek());
assertEquals(str,ladder.pop());
assertEquals(null,ladder.peek());
- for(int j=0;j<i;++j)ladder.descend();
+ for (int j=0;j<i;++j)ladder.descend();
}
assertEquals(ladder.height(),32); // Sizing, when naturally created is by 8
ladder.cutTo(8);
assertEquals(ladder.height(),8);
- for(int i=0;i<30;++i) {
+ for (int i=0;i<30;++i) {
ladder.jumpTo(i);
String str = "Rung " + i;
assertEquals(ladder.peek(),null);
@@ -57,7 +57,7 @@ public class JU_Ladder {
ladder.bottom();
- for(int i=0;i<30;++i) {
+ for (int i=0;i<30;++i) {
assertEquals("Rung " + i,ladder.peek());
ladder.ascend();
}
@@ -66,7 +66,7 @@ public class JU_Ladder {
ladder.top();
assertEquals("Rung 29",ladder.peek());
- for(int i=0;i<30;++i) {
+ for (int i=0;i<30;++i) {
ladder.jumpTo(i);
assertEquals("Rung " + i,ladder.peek());
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java
index 1a5f86f3..ccc29317 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java
@@ -95,7 +95,7 @@ public class JU_RosettaDF {
tt.done();
}
report.glean(trans, 1,2,3,4,5);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw);
@@ -117,7 +117,7 @@ public class JU_RosettaDF {
RosettaData<?> data = df.newData(trans).in(Data.TYPE.JSON).out(Data.TYPE.XML);
data.direct(new StringReader(JU_FromJSON.str), sbw);
report.glean(trans);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java
index de1b5500..a0847f4c 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java
@@ -95,7 +95,7 @@ public class JU_Saved<b> {
tt.done();
}
report.glean(trans,1,2,3,4);
- } while(report.go());
+ } while (report.go());
report.report(sbw);
System.out.println(sbw.toString());
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java
index 7e767e5d..40c41596 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java
@@ -57,7 +57,7 @@ public class JU_Struct {
// Setter<SampleData> setter = jaxSet.setter("id");
// setter.set(sd, "Your ID");
//
-// for(Entry<String, Getter<SampleData>> es : jaxSet.getters()) {
+// for (Entry<String, Getter<SampleData>> es : jaxSet.getters()) {
// System.out.print(es.getKey());
// System.out.print(' ');
// System.out.println(es.getValue().get(sd));
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java
index 032f9f1c..2aca5f52 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java
@@ -120,9 +120,9 @@ public class JU_Types {
Multi multi = new Multi();
MultiMarshal pmulti = new MultiMarshal();
- for(int i=0;i<10;++i) {
+ for (int i=0;i<10;++i) {
System.out.println("===== Multi Iteration " + i + " =====");
- if(i>0) {
+ if (i>0) {
multi.getSingle().add(setSData());
}
System.out.println(" ===== RAW =====");
@@ -151,9 +151,9 @@ public class JU_Types {
Multi multi = new Multi();
DocMarshal<Multi> doc = DocMarshal.root(new MultiMarshal());
- for(int i=0;i<3;++i) {
+ for (int i=0;i<3;++i) {
System.out.println("===== Multi Iteration " + i + " =====");
- if(i>0) {
+ if (i>0) {
multi.getSingle().add(setSData());
}
System.out.println(" ===== RAW =====");
@@ -194,14 +194,14 @@ public class JU_Types {
Trans trans = env.newTrans();
RosettaData<Multi> data = df.newData(trans);
// Prime pump
- for(int i=0;i<100;++i) {
+ for (int i=0;i<100;++i) {
data.load(multi);
}
trans = env.newTrans();
data = df.newData(trans);
int iters = 10000;
- for(int i=0;i<iters;++i) {
+ for (int i=0;i<iters;++i) {
data.load(multi);
}
Metric metrics = trans.auditTrail(0, null,Env.JSON,Env.XML);
@@ -215,13 +215,13 @@ public class JU_Types {
data = df.newData(trans);
// Prime pump
- for(int i=0;i<100;++i) {
+ for (int i=0;i<100;++i) {
data.load(multi);
}
trans = env.newTrans();
data = df.newData(trans);
- for(int i=0;i<iters;++i) {
+ for (int i=0;i<iters;++i) {
data.load(multi);
}
metrics = trans.auditTrail(0, null,Env.JSON,Env.XML);
@@ -235,14 +235,14 @@ public class JU_Types {
data = df.newData(trans);
StringBuilderWriter sbw = new StringBuilderWriter(256);
// Prime pump
- for(int i=0;i<100;++i) {
+ for (int i=0;i<100;++i) {
sbw.reset();
data.direct(multi, sbw, true);
}
trans = env.newTrans();
data = df.newData(trans);
- for(int i=0;i<iters;++i) {
+ for (int i=0;i<iters;++i) {
sbw.reset();
data.direct(multi, sbw, true);
}
@@ -287,7 +287,7 @@ public class JU_Types {
System.out.println(sw);
String result = sw.toString();
- if(!result.equals(str)) {
+ if (!result.equals(str)) {
sw.getBuffer().setLength(0);
new OutRaw().extract(new StringReader(str), sw, in);
System.out.println(sw);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java
index 6ebd07a3..7e230822 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java
@@ -38,7 +38,7 @@ public class OutDump extends Out{
Parsed<S> p = prs.newParsed();
- while((p = prs.parse(in,p.reuse())).valid()) {
+ while ((p = prs.parse(in,p.reuse())).valid()) {
switch(p.event) {
case Parse.START_OBJ:
ipw.append("Start Object ");
@@ -71,9 +71,9 @@ public class OutDump extends Out{
}
private void printData(IndentPrintWriter ipw, Parsed<?> parsed) {
- if(parsed.hasData()) {
+ if (parsed.hasData()) {
ipw.append("Data:[");
- if(parsed.hasName()) {
+ if (parsed.hasName()) {
ipw.append(parsed.name);
ipw.append(" : ");
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java
index df4fec07..acb33010 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java
@@ -46,7 +46,7 @@ public class Report {
Metric m = trans.auditTrail(0, null, type);
total+=m.total;
int min = Math.min(buckets.length, m.buckets.length);
- for(int b=0;b<min;++b) {
+ for (int b=0;b<min;++b) {
buckets[b]+=m.buckets[b];
}
}
@@ -59,7 +59,7 @@ public class Report {
public void report(Writer sbw) throws IOException {
sbw.append("\n"+count + " entries, Total Time: " + total + "ms, Avg Time: " + total/count + "ms\n");
int min = Math.min(buckets.length, names.length);
- for(int i=0;i<min;++i) {
+ for (int i=0;i<min;++i) {
sbw.append(" Time: " + names[i] + ' ' + buckets[i] + "ms, Avg Time: " + buckets[i]/count + "ms\n");
}
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]);
}