<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Home</title><link>https://sourceforge.net/p/spunk/wiki/Home/</link><description>Recent changes to Home</description><atom:link href="https://sourceforge.net/p/spunk/wiki/Home/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 26 May 2016 15:13:40 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/spunk/wiki/Home/feed" rel="self" type="application/rss+xml"/><item><title>Home modified by Sly Technologies</title><link>https://sourceforge.net/p/spunk/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,8 +1,106 @@
-Welcome to your wiki!
+# EasyLibs Spunk API

-This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: [SamplePage].
+An object based namespace and flexible scripting language library. Spunk is most useful in libraries which utilize annotations and wish to provide scripting functionality or and maintain complex/conditional relationships between objects. 

-The wiki uses [Markdown](/p/spunk/wiki/markdown_syntax/) syntax.
+Spunk framework provides two important features:
+* Object based namespace
+* Flexible scripting language executable from java against the namespace 

-[[members limit=20]]
-[[download_button]]
+## Object based namespace
+
+Namespace allows a complex collection of objects and beans to be easily searchable and placed into hierarchies which mimic the file system. In stead of building singletons or maps to reference different part of your business logic systems, create a single namespace and uniquely store any type of objects and reference them by name, path or through search results.
+
+**For example:**
+
+    MutablePath namespace = new PathNode("Q&amp;amp;A"); // Empty root with just a name
+    namespace.add("questions", new ArrayList&amp;lt;String&amp;gt;());
+    namespace.add("answers", new ArrayList&amp;lt;String&amp;gt;());
+    MutablePath users = namespace.add("users");
+    
+    IPath chris = users.add("ChristopherRobins", new ArrayList&amp;lt;String&amp;gt;());
+ 
+    /* From some input method */
+    List&amp;lt;String&amp;gt; christophersQuestions = chris.getData();
+    christophersQuestions.add("Who came up with the name Pooh?");
+ 
+## Spunk Scripts
+
+A script is compiled into binary form and linked against namespace. A script is a regular java string which is compiled. The script can contain expressions or an assignment statements. Expressions always evaluate to a value such as an integer or a boolean. But can evaluate to any type of object, including user objects from namespace.
+The compiler provides compilation methods for two types of scripts.
+
+* _statement_ - an assignment statement (i.e. `"root.a = 10"`)
+* _expression_ - a pure expression that will be evaluated and will produce a result to be returned (i.e. `"root.a + 10 &amp;lt; 100 &amp;amp;&amp;amp; root.b == true"`)
+
+## Spunk Statements
+
+A statement allows both references to be assigned values with '=' character and expressions to be evaluated. Further more, multiple statements and expressions can be specified in the script when separated using a ';' character.
+
+**For example:**
+
+    root.field1 = 10; root.field1 + 1 == 11
+ 
+Will result in assigning integer value of 10 to reference field1, then the expression following the ';' character will be evaluated which will result in a boolean true being returned by the IScript.execute method.
+
+## Spunk Expressions
+
+Spunk expressions look very similar to java expressions.
+
+**For example:**
+
+    root.field1 + 1 == 11 &amp;amp;&amp;amp; root.group2.field13 &amp;lt; (10 - 5 * 2)
+ 
+## Arrays, Lists and Maps
+
+Spunk compiler also allows array and collections references. The syntax for accessing arrays and arrays, lists and maps is using associative array syntax using [] characters. For arrays and lists, the value between [] characters must be an integer. For maps the value between [] can be any object but must match the key used in the underlying map object.
+
+**For example:**
+
+    class MyClass {
+        public final List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();
+        public final Map&amp;lt;String, Integer=""&amp;gt; map = new HashMap&amp;lt;&amp;gt;();
+        public final int[] array = new int[10];
+     }
+ 
+    MyClass obj = new MyClass();
+ 
+    obj.list.add("string1");
+    obj.map.put("key1", 10);
+    obj.array[0] = 100;
+ 
+    MutablePath namespace = new PathNode("root");
+    namespace.addBean("list", obj.list);
+    namespace.addBean("map", obj.map);
+    namespace.addBean("array", obj.array);
+ 
+    namespace.evalStatement("list[0] =  'string2'");
+    namespace.evalStatement("map['key1'] = 20");
+    namespace.evalStatement("array[0] = 200");
+ 
+    System.out.printf("list[0]=%s, map[key1]=%d, array[0]=%d%n", obj.list.get(0),
+                obj.map.get("key1"), obj.array[0]);
+ 
+ 
+This will result in the following output to console:
+
+    list[0]=string2, map[key1]=20, array[0]=200
+ 
+Note that multi-dimensional arrays and accessors are supported in the form 'list[0][1][2][3]' and so forth as long as the underlying object hierachy is made up of lists. You may also mix arrays, lists and maps in multi-dimensional arrays and the appropriate type will be resolved dynamically at runtime to an appropriate setter and getter accessor.
+
+## Exporting beans
+
+Any object that follows the bean pattern can be exported into the namespace and referenced from within the spunk script. All bean properties automatically become available as references. The data types and typecasting is automatically determined and handled, although when mismatched occur, a cast exception may be raised. Also for methods that do not follow the bean naming patter for setters and getters, the properties can be exported manually by listing them during namespace creation.
+
+**For example:**
+
+    String myBean = "hello world";
+    IPath path = new PathNode("root", myBean, "length");
+ 
+    boolean isLongerThen5 = path.evalExpression("root.length &amp;gt; 5");
+ 
+The above spunk expression is equivalent to java expression:
+
+    boolean isLongerThen5 = myBean.length() &amp;gt; 5;
+ 
+Also note that we could have shorted the expression to just `"length &amp;gt; 5"` since spunk will do a search in the namespace for the symbol 'length' and use it when resolved.
+
+The example creates a bean object, which is simply a string. Then it create a namespace in the form of a single IPath node which is bound to myBean. Then it manually exports the property "length" since it does not follow the standard bean pattern for `setLength/getLength` and would not be recognized otherwise. Lastly a script is executed and the expression result is a boolean value which is returned. Since the length of our string is greater then 5 characters, the returned value will be true.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sly Technologies</dc:creator><pubDate>Thu, 26 May 2016 15:13:40 -0000</pubDate><guid>https://sourceforge.net30c16493cd504dd2fd714a40fe46b22a9ef37c39</guid></item><item><title>Home modified by Sly Technologies</title><link>https://sourceforge.net/p/spunk/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Welcome to your wiki!&lt;/p&gt;
&lt;p&gt;This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: &lt;span&gt;[SamplePage]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The wiki uses &lt;a class="" href="/p/spunk/wiki/markdown_syntax/"&gt;Markdown&lt;/a&gt; syntax.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;h6&gt;Project Members:&lt;/h6&gt;
	&lt;ul class="md-users-list"&gt;
		&lt;li&gt;&lt;a href="/u/voytechs/"&gt;Sly Technologies&lt;/a&gt; (admin)&lt;/li&gt;
		
	&lt;/ul&gt;&lt;br/&gt;
&lt;p&gt;&lt;span class="download-button-57410aeb3e5e83429de8954c" style="margin-bottom: 1em; display: block;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sly Technologies</dc:creator><pubDate>Sun, 22 May 2016 01:27:07 -0000</pubDate><guid>https://sourceforge.netd13f2e41081c8009962da82d1933c2cc16fedc0e</guid></item></channel></rss>