Exemple #1
0
        /**
         * Returns a string representation of the environment
         *
         * @return a string representation of the environment
         */
        public override string ToString()
        {
            IStringBuilder builder = TextFactory.CreateStringBuilder("{");

            foreach (KeyValuePair <string, VacuumEnvironment.LocationState> entity in state)
            {
                if (builder.GetLength() > 2)
                {
                    builder.Append(", ");
                }
                builder.Append(entity.GetKey()).Append("=").Append(entity.GetValue());
            }
            int i = 0;

            foreach (KeyValuePair <IAgent, string> entity in agentLocations)
            {
                if (builder.GetLength() > 2)
                {
                    builder.Append(", ");
                }
                builder.Append("Loc").Append(++i).Append("=").Append(entity.GetValue());
            }
            builder.Append("}");
            return(builder.ToString());
        }