C# Класс Rhino.Kit

Collection of utilities
Показать файл Открыть проект

Открытые методы

Метод Описание
AddListener ( object bag, object listener ) : object

Add listener to bag of listeners.

Add listener to bag of listeners. The function does not modify bag and return a new collection containing listener and all listeners from bag. Bag without listeners always represented as the null value.

Usage example:

 private volatile Object changeListeners; public void addMyListener(PropertyChangeListener l) { synchronized (this) { changeListeners = Kit.addListener(changeListeners, l); } } public void removeTextListener(PropertyChangeListener l) { synchronized (this) { changeListeners = Kit.removeListener(changeListeners, l); } } public void fireChangeEvent(Object oldValue, Object newValue) { // Get immune local copy Object listeners = changeListeners; if (listeners != null) { PropertyChangeEvent e = new PropertyChangeEvent( this, "someProperty" oldValue, newValue); for (int i = 0; ; ++i) { Object l = Kit.getListener(listeners, i); if (l == null) break; ((PropertyChangeListener)l).propertyChange(e); } } } 
ClassOrNull ( ClassLoader loader, string className ) : Type

Attempt to load the class of the given name.

Attempt to load the class of the given name. Note that the type parameter isn't checked.

ClassOrNull ( string className ) : Type
CodeBug ( ) : Exception

Throws RuntimeException to indicate failed assertion.

Throws RuntimeException to indicate failed assertion. The function never returns and its return type is RuntimeException only to be able to write throw Kit.codeBug() if plain Kit.codeBug() triggers unreachable code error.

CodeBug ( string msg ) : Exception

Throws RuntimeException to indicate failed assertion.

Throws RuntimeException to indicate failed assertion. The function never returns and its return type is RuntimeException only to be able to write throw Kit.codeBug() if plain Kit.codeBug() triggers unreachable code error.

GetListener ( object bag, int index ) : object

Get listener at index position in bag or null if index equals to number of listeners in bag.

Get listener at index position in bag or null if index equals to number of listeners in bag.

For usage example, see AddListener(object, object) .

InitCause ( Exception ex, Exception cause ) : Exception

If initCause methods exists in Throwable, call ex.initCause(cause) or otherwise do nothing.

If initCause methods exists in Throwable, call ex.initCause(cause) or otherwise do nothing.

MakeHashKeyFromPair ( object key1, object key2 ) : object
ReadReader ( TextReader r ) : string
ReadStream ( Stream @is, int initialBufferCapacity ) : byte[]
RemoveListener ( object bag, object listener ) : object

Remove listener from bag of listeners.

Remove listener from bag of listeners. The function does not modify bag and return a new collection containing all listeners from bag except listener. If bag does not contain listener, the function returns bag.

For usage example, see AddListener(object, object) .

XDigitToInt ( int c, int accumulator ) : int

If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number.

If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number. Otherise return -1.

Приватные методы

Метод Описание
InitHash ( object>.IDictionary h, object key, object initialValue ) : object
Kit ( ) : System
NewInstanceOrNull ( Type cl ) : object
TestIfCanLoadRhinoClasses ( ClassLoader loader ) : bool

Check that testClass is accessible from the given loader.

Check that testClass is accessible from the given loader.

Описание методов

AddListener() публичный статический Метод

Add listener to bag of listeners.
Add listener to bag of listeners. The function does not modify bag and return a new collection containing listener and all listeners from bag. Bag without listeners always represented as the null value.

Usage example:

 private volatile Object changeListeners; public void addMyListener(PropertyChangeListener l) { synchronized (this) { changeListeners = Kit.addListener(changeListeners, l); } } public void removeTextListener(PropertyChangeListener l) { synchronized (this) { changeListeners = Kit.removeListener(changeListeners, l); } } public void fireChangeEvent(Object oldValue, Object newValue) { // Get immune local copy Object listeners = changeListeners; if (listeners != null) { PropertyChangeEvent e = new PropertyChangeEvent( this, "someProperty" oldValue, newValue); for (int i = 0; ; ++i) { Object l = Kit.getListener(listeners, i); if (l == null) break; ((PropertyChangeListener)l).propertyChange(e); } } } 
public static AddListener ( object bag, object listener ) : object
bag object Current collection of listeners.
listener object Listener to add to bag
Результат object

ClassOrNull() публичный статический Метод

Attempt to load the class of the given name.
Attempt to load the class of the given name. Note that the type parameter isn't checked.
public static ClassOrNull ( ClassLoader loader, string className ) : Type
loader ClassLoader
className string
Результат System.Type

ClassOrNull() публичный статический Метод

public static ClassOrNull ( string className ) : Type
className string
Результат System.Type

CodeBug() публичный статический Метод

Throws RuntimeException to indicate failed assertion.
Throws RuntimeException to indicate failed assertion. The function never returns and its return type is RuntimeException only to be able to write throw Kit.codeBug() if plain Kit.codeBug() triggers unreachable code error.
public static CodeBug ( ) : Exception
Результат System.Exception

CodeBug() публичный статический Метод

Throws RuntimeException to indicate failed assertion.
Throws RuntimeException to indicate failed assertion. The function never returns and its return type is RuntimeException only to be able to write throw Kit.codeBug() if plain Kit.codeBug() triggers unreachable code error.
public static CodeBug ( string msg ) : Exception
msg string
Результат System.Exception

GetListener() публичный статический Метод

Get listener at index position in bag or null if index equals to number of listeners in bag.
Get listener at index position in bag or null if index equals to number of listeners in bag.

For usage example, see AddListener(object, object) .

public static GetListener ( object bag, int index ) : object
bag object Current collection of listeners.
index int Index of the listener to access.
Результат object

InitCause() публичный статический Метод

If initCause methods exists in Throwable, call ex.initCause(cause) or otherwise do nothing.
If initCause methods exists in Throwable, call ex.initCause(cause) or otherwise do nothing.
public static InitCause ( Exception ex, Exception cause ) : Exception
ex System.Exception
cause System.Exception
Результат System.Exception

MakeHashKeyFromPair() публичный статический Метод

public static MakeHashKeyFromPair ( object key1, object key2 ) : object
key1 object
key2 object
Результат object

ReadReader() публичный статический Метод

public static ReadReader ( TextReader r ) : string
r System.IO.TextReader
Результат string

ReadStream() публичный статический Метод

public static ReadStream ( Stream @is, int initialBufferCapacity ) : byte[]
@is Stream
initialBufferCapacity int
Результат byte[]

RemoveListener() публичный статический Метод

Remove listener from bag of listeners.
Remove listener from bag of listeners. The function does not modify bag and return a new collection containing all listeners from bag except listener. If bag does not contain listener, the function returns bag.

For usage example, see AddListener(object, object) .

public static RemoveListener ( object bag, object listener ) : object
bag object Current collection of listeners.
listener object Listener to remove from bag
Результат object

XDigitToInt() публичный статический Метод

If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number.
If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number. Otherise return -1.
public static XDigitToInt ( int c, int accumulator ) : int
c int
accumulator int
Результат int