simplified AttributeAccess :)
simplified ActionItem
this resolves XML dom trees
simple base class to decouple parsing the elements from their actual functionality
A Logging trait you can mix into an implementation class without affecting its public API
A Logging trait you can mix into an implementation class without affecting its public API
NOTE: IF you get an anon class name, you can override the logger: protected override val logger = newlog (classOf)
NOTE: the formatting uses java.lang.String.format NOT slf4j formatting by reason of clusterfuk
test that results are near some expeted results
thread local static object - ThreadLocal is easy to implement, not neccessarily to use
thread local static object - ThreadLocal is easy to implement, not neccessarily to use
Note this is not quite per-thread only...it is per ExecutionContext, so there can be multiple "statics" per JVM - see that class
Use like
public static NoStatic
.
On a thread, reset the default value if needed:
myStatic.set(newValue)
In code, access like a static, don't worry about thread:
myStatic.get
or myStatic()
see TLNoStatic for why ThreadLocal is not usable
com.razie.pub.base.ExecutionContext
com.razie.pub.base.test.TestNoStatic
some string utilities
sample state machine
wraps an URL with some arguments to be passed in the call
much simplified unit test primitives: expect()
helper trait - include this to get the url constructs
helper trait - include this to get the url constructs
See class snakking.test.SampleWebTest for examples
hierarchical implementation - this one adds stuff to a parent's
a simple resolver for x path like stuff.
a simple resolver for x path like stuff. note the limitation at the bottom
can resolve the following expressions
/a/b/c /a/b/@c /a/b[cond]/... /a/{assoc}b[cond]/...
/ a / * / c - ignore one level: explore all possibilities for just that level
One difference from classic xpath is that the root node can be specified, see "a" above
It also differs from a classic xpath by having the {assoc} option. Useful when navigating models that use assocations as well as composition (graphs). Using "/a/{assoc}b" means that it will use association {assoc} to find the b starting from a...
TODO the type system here is all gefuckt...need better understanding of variance in scala. See this http://www.nabble.com/X-String--is-not-a-subtype-of-X-AnyRef--td23428970.html
Example usage:
NOTE - this is stateless with respect to the parsed object tree - it only keeps the pre-compiled xpath expression so you should reuse them as much as possible
Note that this is a limited play-type thing. There are full XPATH implementations to browse stuff, like Apache's JXpath.
The main features of this implementation are: 1) small and embeddable 2) works for most every-day things and 3) extensiblity: you can easily plugin resolvers.
Simple helper to simplify client code when the context doesn't change: it pairs an XP with a particular context/solver.
Simple helper to simplify client code when the context doesn't change: it pairs an XP with a particular context/solver.
So you can just use it after creation and not worry about carrying both arround.
the condition of an element in the path.
the condition of an element in the path.
TODO 3-2 maybe i should extract a trait and use it?
this default implementation supports something like "[@attrname==15]"
an element in the path: "{assoc}@prefix:name[cond]"
the strategy to break down the input based on the current path element.
the strategy to break down the input based on the current path element. The solving algorithm is: apply current sub-path to current sub-nodes, get the results and RESTs. Filter by conditions and recurse.
simplify usage of AttrAccess - attribute management
simplified ActionItem
simplified ActionItem
i really should drop the stupid java base classes and move it all to scala
i can never find the stupid parse methods Adapted by Alexandre Martins
helper class - has all the conversions
TODO 1-1 copy NoStatics docs here and ditch old one?
replaces getOrElse, orElse AND if(String.length>1) x else y
MT performance testing tools
conversions from java to scala collections
conversions from java to scala collections
probably the thing I hate the most about scala: interacting with Java collections
use like this: RJS(javalist).foreach -OR- RJS apply javalist foreach -OR- RJS list javalist sort OR for (x <- RJS.apply(whatever-java-threw-at-you))...
conversions from scala to java collections.
conversions from scala to java collections. TRY NOT TO do this, unless you absolutely have to :)
probably the thing I hate the most about scala: interacting with Java collections
use like this RSJ(scalalist)
state machines have states, transitions and consume events
this resolves scala xml dom trees
sed like filter using Java regexp
sed like filter using Java regexp
example: from US to normal: Sed ("""(\d\d)/(\d\d)/(\d\d)""", """\2/\1/\3""", "01/31/12")
Essentially useless since plain "sss".replaceAll(..., "$1 $2...") works almost the same way..
rapid decomposition of data in different formats, from different sources
rapid decomposition of data in different formats, from different sources
NOTE that snakking will wrap the snacked so you'll need to unwrap at the end, so an expression like { root \ "j" map identity } is the same as { for ( n <- root \ "j" ) yield n }
this example resolves strings with the /x/y/z format
multithreading helpers, to tie me over until I learn to effectively exploit actors or other inferior beings
unix like commons - easy to invoke
Example of creating a dedicated solver
overwrite this if you want other scriptables for conditions...it's just a syntax marker
c++ memories, anyone...
c++ memories, anyone... i do like to use the cout << x instead of println(x)
c++ memories, anyone...
c++ memories, anyone... i do like to use the cout << x instead of println(x)
c++ memories, anyone...
c++ memories, anyone... i do like to use the cout << x instead of println(x)
c++ memories, anyone...
c++ memories, anyone... i do like to use the cout << x instead of println(x)
c++ memories, anyone...
c++ memories, anyone... i do like to use the cout << x instead of println(x)
json helpers
json helpers
a json is represented as maps of (name,value) and lists of values, either of which can be recursive, representing a json object via a map and an array as a list.
we do not have a common Node class - but simple Map and List
just some fun operator to keep the code looking nice
simplified ActionItem
i really should drop the stupid java base classes and move it all to scala