Graphviz语言从jsp视图动态
我有一些角色,每个角色都有用户。
所以我的问题是根据没有。角色数量和数量。我必须使用 graphviz 创建一个图表。 Graphviz 语言就像 (A -> B;)(B -> C;)(B -> D;)(C -> E;)(D -> E;)(E -> F )
所以我必须根据我拥有的角色和没有角色来创建一种图形语言。我选择的用户数...
传入的字符串类似于 = (1CS_3Admin_1BOD_2SH_1Others)。 这种语言的图表可能是这样的:-
marapet 这就是我正在做的事情。
我的语言类似于 1CS_3Admin_1BOD_2SH_1Others 其中 1,3,1,2 是所选用户的数量,例如 1CS 表示一个用户担任 CS 角色。现在我用“_”作为分隔符将它们分开。现在我得到一个字符串数组。所以真正的问题是从这个字符串数组值创建一种语言。 这里的“名称”是我得到的字符串:-
Graphviz gv = new Graphviz();
gv.addln(gv.start_graph());
gv.addln("Start;");
if(name.startsWith("_"));
name=name.substring(1);
String[] str=null;
if(name.contains("_"))
str = name.split("_");
int sPreviousRepeat=0;
String sPrevious="";
int sCurrRepeat=0;
String sCurr="";
String finalInst="Start -> ";
for(int i=0;i<str.length;i++) {
sCurrRepeat=Integer.parseInt(String.valueOf(str[i].charAt(0)));
sCurr=str[i].substring(1);
if(i!=0){
sPreviousRepeat = Integer.parseInt(String.valueOf(str[i-1].charAt(0)));
sPrevious = str[i-1].substring(1);
}
if(sCurrRepeat==1){
if(i==0)
finalInst=finalInst+sCurr+";";
else
finalInst=finalInst + sPrevious+" -> "+sCurr+";";
}
else{
for(int j=0;j<sCurrRepeat;j++){
//cant figure out?????
}
}
}
I have some roles and each roles have users.
So my problem is according to the no. of roles and no. of users selected i have to create a graph using graphviz.
Graphviz language is like (A -> B;)(B -> C;)(B -> D;)(C -> E;)(D -> E;)(E -> F)
So i have to create a graph language according to no of roles i have and no. of users i selected...
The incoming string is like = (1CS_3Admin_1BOD_2SH_1Others).
And the graph for this language myst be like this:-
marapet This is what i am doing.
My language is like 1CS_3Admin_1BOD_2SH_1Others Where 1,3,1,2 is the no of users selected e.g 1CS means one user for CS role. Now i split them with '_' as delimiter . Now i get a string array . So the real problem is to make a language from this string array values.
Here 'name' is the string i am getting:-
Graphviz gv = new Graphviz();
gv.addln(gv.start_graph());
gv.addln("Start;");
if(name.startsWith("_"));
name=name.substring(1);
String[] str=null;
if(name.contains("_"))
str = name.split("_");
int sPreviousRepeat=0;
String sPrevious="";
int sCurrRepeat=0;
String sCurr="";
String finalInst="Start -> ";
for(int i=0;i<str.length;i++) {
sCurrRepeat=Integer.parseInt(String.valueOf(str[i].charAt(0)));
sCurr=str[i].substring(1);
if(i!=0){
sPreviousRepeat = Integer.parseInt(String.valueOf(str[i-1].charAt(0)));
sPrevious = str[i-1].substring(1);
}
if(sCurrRepeat==1){
if(i==0)
finalInst=finalInst+sCurr+";";
else
finalInst=finalInst + sPrevious+" -> "+sCurr+";";
}
else{
for(int j=0;j<sCurrRepeat;j++){
//cant figure out?????
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下面是我分解问题的方法:
需要学习以下内容:
Here's how I'd break down the problem:
You'll need to learn the following:
我想我能做到。
I think i make it.