Skip to content

Commit

Permalink
Minor tweak to restore lost commit
Browse files Browse the repository at this point in the history
Change-Id: I1a0e0c389ffced743dcb02722459c00397f02a4f
Signed-off-by: thsiung <[email protected]>
  • Loading branch information
thsiung committed Feb 19, 2018
1 parent ad66f64 commit c582802
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 199 deletions.
66 changes: 40 additions & 26 deletions models/model.template
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Multiplier {
public static ArrayList<Object> multiply(String str) {
Object predictedClassValue = null;
ArrayList<Object> predictList = new ArrayList<Object>();

StringTokenizer st = new StringTokenizer(str, "\n");
while(st.hasMoreTokens()) {
predictedClassValue = getMultiply(st.nextToken());
predictList.add(predictedClassValue);
}

return predictList;
}

private static Object getMultiply(String str) {
System.out.println("Input Str: " + str);
StringTokenizer st = new StringTokenizer(str, ",");
Integer sum = 2;

while (st.hasMoreTokens()) {
sum = sum * Integer.parseInt((st.nextToken().trim()));
}

System.out.println("2 * " + str + " = " + sum.toString());
return sum.toString();
}
}
public static ArrayList<Object> multiply(String str) {
Object predictedClassValue = null;
ArrayList<Object> predictList = new ArrayList<Object>();

StringTokenizer st = new StringTokenizer(str, "\n");
while (st.hasMoreTokens()) {
predictedClassValue = getMultiply(st.nextToken());
predictList.add(predictedClassValue);
}

return predictList;
}

private static Object getMultiply(String str) {
System.out.println("Input Str: " + str);
StringTokenizer st = new StringTokenizer(str, ",");
Integer sum = 2;

while (st.hasMoreTokens()) {
sum = sum * Integer.parseInt((st.nextToken().trim()));
}

System.out.println("2 * " + str + " = " + sum.toString());
return sum.toString();
}

public static ArrayList<Object> classify(String str) {
Object pVal = null;
ArrayList<Object> pList = new ArrayList<Object>();
StringTokenizer st = new StringTokenizer(str, "\n");
while (st.hasMoreTokens()) {
pVal = st.nextToken() + "," + 9 + ",Hello," + 2 + "\n";
pList.add(pVal);
}

return pList;

}
}
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
</images>
</configuration>
<!-- build Docker images in install phase, push in deploy phase -->
<!--
<executions>
<execution>
<goals>
Expand All @@ -246,6 +247,7 @@
</goals>
</execution>
</executions>
-->
</plugin>
</plugins>

Expand Down
Loading

0 comments on commit c582802

Please sign in to comment.