This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creating a instance by using FEST Reflection for testing of Swing Application Framework | |
* require import static org.fest.reflect.core.Reflection.*; | |
*/ | |
protected static <C extends Application> C createApplicationInstance(Class<C> appClass, String[] args) { | |
C application = | |
staticMethod("create") | |
.withReturnType(appClass) | |
.withParameterTypes(Class.class) | |
.in(appClass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Invoke method by using reflection. | |
* Require PHP5 (>= 5.3.2) | |
* @param $method_name | |
* @param $obj - An object that invokes the method. | |
* @param mothod_args... Arguments for the method. | |
*/ | |
public static function invoke_method($method_name, $obj) { | |
$class_name = get_class($obj); | |
$class = new ReflectionClass($class_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'A': 'A', 'C': 'C', 'G': 'G', 'T': '[TU]', | |
'R': '[AG]', 'Y': '[CTU]', 'S': '[GC]', | |
'W': '[ATU]', 'K': '[GTU]', 'M': '[AC]', | |
'B': '[CGTU]', 'D': '[AGTU]', | |
'H': '[ACTU]', 'V': '[ACG]', | |
'N': '[ACGTU]' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private exportSelf As Boolean | |
Public Const MODULE_NAME_SPACE As String = "VBACodeExporter" | |
Private Enum ComponentType | |
STANDARD_MODULE = 1 | |
CLASS_MODULE = 2 | |
USER_FORM = 3 | |
DOCUMENT_MODULE = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static javax.swing.SpringLayout.*; | |
import java.awt.BorderLayout; | |
import java.awt.Dimension; | |
import javax.swing.BorderFactory; | |
import javax.swing.JLabel; | |
import javax.swing.JPanel; | |
import javax.swing.JScrollPane; | |
import javax.swing.JTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import java.awt.Color; | |
import org.junit.Test; | |
public class AlphaDigitsHexNumberColorDecodingTest { | |
@Test | |
public void decodeHexStringToColor() { | |
Color color = Color.decode("#000000"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JFrame; | |
public class ViewTest { | |
ViewTest craeteView() { | |
return new ViewTest(); | |
} | |
public static void main(String[] args) { | |
final ViewTest test = new ViewTest(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LimitValueTest { | |
@Test | |
public void limitOfInteger() { | |
assertEquals(2147483647, Integer.MAX_VALUE); | |
assertEquals(0x7fffffff, Integer.MAX_VALUE); | |
assertEquals(-2147483648, Integer.MIN_VALUE); | |
assertEquals(-0x80000000, Integer.MIN_VALUE); | |
} | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.beans.{PropertyChangeListener, PropertyChangeSupport, PropertyChangeEvent} | |
trait PropertyChangePublisher { | |
private lazy val propertyChangeSupport = new PropertyChangeSupport(this) | |
def addPropertyChangeListener(listener: PropertyChangeListener) = | |
propertyChangeSupport.addPropertyChangeListener(listener) | |
def removePropertyChangeListener(listener: PropertyChangeListener) = | |
propertyChangeSupport.removePropertyChangeListener(listener) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object LoanPatternLock { | |
import java.util.concurrent.locks.{Lock, ReadWriteLock} | |
def lockWith[A <% Lock, B](l: A)(e: => B) = { | |
l.lock() | |
try e finally l.unlock() | |
} | |
def readLockWith[A <% ReadWriteLock, B](l: A)(e: => B) = | |
lockWith(l.readLock)(e) |
OlderNewer