Example #1
0
 public Polylist subBlocksToRoadmapSave() {
   PolylistBuffer buffer = new PolylistBuffer();
   buffer.append(BLOCKS_KEYWORD);
   for (Block subBlock : subBlocks) {
     buffer.append(subBlock.toRoadmapSave());
   }
   return buffer.toPolylist();
 }
Example #2
0
  /**
   * toBrickDefinition Returns a Polylist formatted specifically to replicate the Brick's original
   * definition format
   *
   * @return a Polylist containing the Brick's definition information
   */
  public Polylist toBrickDefinition() {
    PolylistBuffer buffer = new PolylistBuffer();

    for (Block b : getSubBlocks()) {
      buffer.append(b.toPolylist());
    }
    if (!variant.equals("")) {
      return Polylist.list(
              BrickLibrary.DEF_BRICK,
              dashed(name) + "(" + variant + ")",
              mode,
              dashed(type),
              BrickLibrary.keyNumToName(key))
          .append(buffer.toPolylist());
    } else {
      return Polylist.list(
              BrickLibrary.DEF_BRICK,
              dashed(name),
              mode,
              dashed(type),
              BrickLibrary.keyNumToName(key))
          .append(buffer.toPolylist());
    }
  }
Example #3
0
 /**
  * toRoadmapSave is used to create a Polylist for saving to a RoadMap This is NOT the same as the
  * Polylist usedd to save in the dictionary. Returns a Polylist representation of a Brick.
  *
  * @return a Polylist containing the Brick's contents
  */
 @Override
 public Polylist toRoadmapSave() {
   PolylistBuffer buffer = new PolylistBuffer();
   buffer.append(BRICK_KEYWORD);
   buffer.append(Polylist.list("name", dashed(name)));
   buffer.append(Polylist.list("variant", variant));
   buffer.append(Polylist.list("type", type));
   buffer.append(Polylist.list("key", BrickLibrary.keyNumToName(key)));
   buffer.append(Polylist.list("mode", mode));
   buffer.append(Polylist.list("duration", duration));
   buffer.append(Polylist.list("overlap", overlap));
   buffer.append(Polylist.list("end", endValue));
   buffer.append(subBlocksToRoadmapSave());
   return buffer.toPolylist();
 }