Last active
November 19, 2016 22:29
-
-
Save miho/85dd2f0fd91183f636c4f438d2244748 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package eu.mihosoft.vrl.user; | |
import java.text.NumberFormat; | |
import java.text.DecimalFormat; | |
@ComponentInfo(name="Vector2String", category="ODE") | |
public class Vector2String implements java.io.Serializable { | |
private static final long serialVersionUID=1L; | |
@OutputInfo(style="default") | |
public String print(@ParamInfo(name="Vector", options="serialization=false") double[] vector) { | |
DecimalFormat df = new DecimalFormat("0.0000") | |
StringBuilder sb = new StringBuilder(); | |
sb.append("| ") | |
System.out.print("| ") | |
for (int i = 0; i < vector.length; i++) { | |
String entry = df.format(vector[i]).replace(",",".") + "\t" | |
sb.append(entry) | |
System.out.print(entry) | |
} | |
System.out.println("|") | |
sb.append("|\n") | |
return sb.toString() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment