コード例 #1
0
ファイル: OD.java プロジェクト: elenadorogush/aurora
 /**
  * Validates the OD configuration.
  *
  * @return <code>true</code> if configuration is correct, <code>false</code> - otherwise.
  * @throws ExceptionConfiguration
  */
 public boolean validate() throws ExceptionConfiguration {
   AbstractLink lk;
   boolean res = true;
   for (int i = 0; i < pathList.size(); i++) {
     lk = pathList.get(i).getBegin();
     if (lk.getBeginNode() != null) res = origin.equals(lk.getBeginNode());
     else res = origin.equals(lk.getEndNode());
     if (!res)
       throw new ExceptionConfiguration(
           "Path ("
               + pathList.get(i).toString()
               + ") has wrong begin Link ("
               + pathList.get(i).getBegin().getId()
               + ").");
     lk = pathList.get(i).getEnd();
     if (lk.getEndNode() != null) res = destination.equals(lk.getEndNode());
     else res = destination.equals(lk.getBeginNode());
     if (!res)
       throw new ExceptionConfiguration(
           "Path ("
               + pathList.get(i).toString()
               + ") has wrong end Link ("
               + pathList.get(i).getEnd().getId()
               + ").");
   }
   return res;
 }
コード例 #2
0
ファイル: OD.java プロジェクト: elenadorogush/aurora
 /**
  * Generates XML description of the OD.<br>
  * If the print stream is specified, then XML buffer is written to the stream.
  *
  * @param out print stream.
  * @throws IOException
  */
 public void xmlDump(PrintStream out) throws IOException {
   if (out == null) out = System.out;
   out.print("<od begin=\"" + origin.getId() + "\" end=\"" + destination.getId() + "\">\n");
   out.print("<PathList>\n");
   for (int i = 0; i < pathList.size(); i++) pathList.get(i).xmlDump(out);
   out.print("</PathList>\n</od>\n");
   return;
 }
コード例 #3
0
ファイル: OD.java プロジェクト: elenadorogush/aurora
 /**
  * Overrides <code>java.lang.Object.toString()</code>.
  *
  * @return string that describes the OD.
  */
 public String toString() {
   return origin.getName() + " > " + destination.getName();
 }