Mercurial > hg > Members > tatsuki > Alice
diff src/main/java/alice/test/topology/fish/Routing.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/topology/fish/Routing.java Wed Apr 16 18:26:07 2014 +0900 @@ -0,0 +1,35 @@ +package alice.test.topology.fish; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.msgpack.annotation.Message; +import org.msgpack.annotation.Optional; + +@Message +public class Routing { + + public String name; + public int id; + public int width; + @Optional public int startX; + + public Routing() {} + + public Routing(String name, int width) { + this.name = name; + this.width = width; + Pattern pattern = Pattern.compile("^child([0-9]+)$"); + Matcher matcher = pattern.matcher(name); + matcher.find(); + id = new Integer(matcher.group(1)); + } + + public Routing(String name, int id, int width, int startX) { + this.name = name; + this.id = id; + this.width = width; + this.startX = startX; + } + +}