Пример #1
0
  @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
 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
 }