コード例 #1
0
ファイル: RTObjectCommon.java プロジェクト: rvalimaki/trygve
  @Override
  public void enlistAsRolePlayerForContext(
      final String roleName, final RTContextObject contextInstance) {
    List<String> rolesIAmPlayingHere = null;
    if (rolesIAmPlayingInContext_.containsKey(contextInstance)) {
      rolesIAmPlayingHere = rolesIAmPlayingInContext_.get(contextInstance);
    } else {
      rolesIAmPlayingHere = new ArrayList<String>();
      rolesIAmPlayingInContext_.put(contextInstance, rolesIAmPlayingHere);
    }

    rolesIAmPlayingHere.add(roleName);

    int count = 0;
    for (final Map.Entry<RTContextObject, List<String>> iter :
        rolesIAmPlayingInContext_.entrySet()) {
      count += iter.getValue().size();
    }
    if ((1 < count) && (1 < rolesIAmPlayingInContext_.size())) {
      ErrorLogger.error(
          ErrorType.Fatal,
          "Object of type ",
          this.rTType().name(),
          " playing too many roles, including ",
          roleName);
      for (Map.Entry<RTContextObject, List<String>> iter : rolesIAmPlayingInContext_.entrySet()) {
        final StringBuffer stringBuffer = new StringBuffer();
        final String contextName = iter.getKey().rTType().name();
        final List<String> roleNames = iter.getValue();
        stringBuffer.append("\tIn Context ");
        stringBuffer.append(contextName);
        stringBuffer.append(":");
        for (final String aRoleName : roleNames) {
          stringBuffer.append(" ");
          stringBuffer.append(aRoleName);
        }
        final String message = stringBuffer.toString();
        ErrorLogger.error(ErrorType.Fatal, message, ".", "", "");
      }
    }
  }
コード例 #2
0
ファイル: SetClass.java プロジェクト: rvalimaki/trygve
 public RTCode runDetails(final RTObject scope) {
   // Effectively a pure virtual method, but Java screws us again...
   ErrorLogger.error(ErrorType.Internal, "call of pure virutal method runDetails", "", "", "");
   return null; // halt the machine
 }