[GRASS-SVN] r49195 - grass-addons/grass7/raster/r.agent/libagent
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 13 10:59:38 EST 2011
Author: mic
Date: 2011-11-13 07:59:38 -0800 (Sun, 13 Nov 2011)
New Revision: 49195
Added:
grass-addons/grass7/raster/r.agent/libagent/__init__.py
grass-addons/grass7/raster/r.agent/libagent/error.py
grass-addons/grass7/raster/r.agent/libagent/playground.py
grass-addons/grass7/raster/r.agent/libagent/world.py
Log:
adding stubs for new version
Added: grass-addons/grass7/raster/r.agent/libagent/__init__.py
===================================================================
Added: grass-addons/grass7/raster/r.agent/libagent/error.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/error.py (rev 0)
+++ grass-addons/grass7/raster/r.agent/libagent/error.py 2011-11-13 15:59:38 UTC (rev 49195)
@@ -0,0 +1,30 @@
+############################################################################
+#
+# MODULE: r.agent.*
+# AUTHOR(S): michael lustenberger inofix.ch
+# PURPOSE: library file for the r.agent.* suite
+# COPYRIGHT: (C) 2011 by Michael Lustenberger and the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
+class Error(Exception):
+ """Base class for exceptions in this module."""
+ pass
+
+class DataError(Error):
+ """Exception raised for errors in the input.
+
+ Attributes:
+ expr -- Context expression in which the error occurred
+ msg -- explanation of the error
+ """
+ def __init__(self, expr, msg):
+ self.expr = expr
+ self.msg = msg
+ print "DataError: " + expr + " " + msg
+
+
Added: grass-addons/grass7/raster/r.agent/libagent/playground.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/playground.py (rev 0)
+++ grass-addons/grass7/raster/r.agent/libagent/playground.py 2011-11-13 15:59:38 UTC (rev 49195)
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE: r.agent.*
+# AUTHOR(S): michael lustenberger inofix.ch
+# PURPOSE: very basic test collection for the r.agent.* suite
+# COPYRIGHT: (C) 2011 by Michael Lustenberger and the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
+class Playground(object):
+ """A Playground is a major component of a World,
+ defining and organizing space."""
+ def __init__(self):
+ self.layers = dict()
+ self.offset = [None,None]
+ self.limit = [None,None]
+ self.steps = []
+ def setbounds(self, north=None, south=None, east=None, west=None,
+ rows=None, cols=None):
+ pass
+ def getbounds(self):
+ return []
+ def setlayer(self, layername, layer, force=False):
+ pass
+ def createlayer(self, layername, grassmap=False):
+ pass
+ def getlayer(self, layername):
+ return []
+ def removelayer(self, layername):
+ pass
+ def writelayer(self, layername):
+ pass
+
Added: grass-addons/grass7/raster/r.agent/libagent/world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/world.py (rev 0)
+++ grass-addons/grass7/raster/r.agent/libagent/world.py 2011-11-13 15:59:38 UTC (rev 49195)
@@ -0,0 +1,51 @@
+############################################################################
+#
+# MODULE: r.agent.*
+# AUTHOR(S): michael lustenberger inofix.ch
+# PURPOSE: library file for the r.agent.* suite
+# COPYRIGHT: (C) 2011 by Michael Lustenberger and the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
+class World(object):
+ """Generic World class as basis for more complex worlds."""
+ def __init__(self, agenttype=None, pg=None):
+# if pg == None:
+# self.playground = playground.Playground()
+# else:
+# self.playground = pg
+# self.agentclass = agent.Agent
+# if agenttype == None:
+# self.agenttype = self.agentclass
+# else:
+# self.setagenttype(agenttype)
+ self.agents = []
+ self.artefacts = []
+ def addlayertopg(layername, layertype):
+ pass
+ def getlayer(layername):
+ pass
+# return layer
+ def rmlayer(layername):
+ pass
+ def setagentype(agentype):
+ pass
+ def getagenttype():
+ pass
+# return agenttype
+ def bear(timetolive, position, agenttype):
+ pass
+# return agent
+ def getnextagent():
+ return next(agents)
+ def move(agent, position):
+ pass
+ def getposition(agent):
+ pass
+ def kill(agent):
+ pass
+
More information about the grass-commit
mailing list