Wednesday, September 21, 2011

Tech Review: Wednesday, September 21, 2011

Working with porting C# to Java today.

  • It is sort of like a class because you can override method inside the enum.
    • @Override public String toString() {....}
Struct like objects in Java:  
  • Has lots of really nice and clear comparisons.
  • I need to read the whole thing
Ternary or conditional operator in Java:  http://www.janeg.ca/scjp/oper/ternary.html
  • operand1 ? operand2 : operand3;
    • operand1 must be a boolean value or experssion
The C# dictionary is similar to the Java Map interface:  
The ArrayList Generic Class in Java:
The C# ICollection interface:

A Java tutorial on collection interfaces:  
Today I was confused as to why code would compile in my simple command line program and not in Eclipse.
  • Sometimes the error messages in Eclipse are miss leading
  • I was trying to write code in the class body outside a method
  • if (child == null) child = new Lista(c, null);
A tutorial on Eclipse:

Java Properties and C# properties are not the same thing at all:  http://download.oracle.com/javase/1.4.2/docs/api/java/util/Properties.html
  • C# properties are a value in the object
  • Java properties are a way of saving the state to a file and reading it back
Another very nice Java/C# Comparison:  http://www.harding.edu/fmccown/java_csharp_comparison.html
  • This one would be best to read first
Java random number generation:
In doing Repast Simphony development, the RandomHelper class should be used:
A very nice example of a Java singleton implementation:  http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html

Default parameters in Java:
Declaring generic arrays:
  • http://forums.techarena.in/software-development/1117589.htm
    • HashMap <?,?> [] x = new HashMap <?,?>[3];
      • this work but I could access 'x'
    • Best to avoid and wrap in a list instead
      • List<HashMap<Class, Class> x = new ArrayList<HashMap<Class1, Class2>(3);
      • the above code may not be correct, but it has the idea
C# ArgumentException can be changed to a Java IllegalArgumentException:  https://forums.oracle.com/forums/thread.jspa?threadID=472866

  • performance advantages in C#
For each Loop in Java:
Generics and array construction in Java:
Comparison between Java HashMap and .NET Hastable:  http://www.microsoft.com/mspress/books/sampchap/6173.aspx#116

  • List myList = new ArrayList (collection);
  • Collections.sort (mylist);


Wednesday, September 7, 2011

Repast Simphony Projections

  • Interface Projection
    • http://repast.sourceforge.net/docs/api/repastjava/repast/simphony/space/projection/Projection.html
    • interface ContinuousSpace
      • AbstractContinuousSpace
      • ContextPhysics
      • ContextSpace
      • DefaultContinuousSpace 
      • DefaultPhysicsSpace
      • Projected3DSpace
    • interface Geography
      • ContextGeography
      • DefaultGeography
    • interface Grid
      • AbstractGrid, 
      • ContextFastSingleGrid, 
      • ContextGrid, 
      • DefaultGrid, 
      • FastDenseSingleOccuGrid, 
      • Projected3DGrid
    • interface NetWork
      • ContextJungNetwork, 
      • DirectedJungNetwork, 
      • JungNetwork, 
      • UndirectedJungNetwork
    • interface PysicsSpace
      • ContextPhysics
      • DefaultPhysicsSpace
    • Implementing Classes
      • Abstract
        1. AbstractContinuousSpace, 
        2. AbstractGrid, 
      • Concrete 
        1. ContextFastSingleGrid, 
        2. ContextGeography, 
        3. ContextGrid, 
        4. ContextJungNetwork, 
        5. ContextPhysics, 
        6. ContextSpace, 
        7. DefaultContinuousSpace, 
        8. DefaultGeography, 
        9. DefaultGrid, 
        10. DefaultPhysicsSpace, 
        11. DefaultProjection, 
        12. DirectedJungNetwork, 
        13. FastDenseSingleOccuGrid, 
        14. JungNetwork, 
        15. Projected3DGrid, 
        16. Projected3DSpace, 
        17. UndirectedJungNetwork