|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.shabarshin.jemul.jeComponent
Class of abstract component for jEmul (universal emulator of discrete schemes in Java).
| Field Summary | |
protected boolean |
flag_pullup
Flag that indicates pull up feature switched on. |
protected java.lang.String |
name
Name of the component. |
protected char[] |
pin
Array that defines types of pins. |
static char |
PIN_GND
The constant indicates ground type of the pin and equals 'G' character. |
static char |
PIN_INPUT
The constant indicates input type of the pin and equals 'I' character. |
static char |
PIN_NC
The constant indicates not-connected type of the pin and equals 'N' character. |
static char |
PIN_OPEN
The constant indicates open-drain (or open-collector) type of the pin and equals 'D' character. |
static char |
PIN_OUTPUT
The constant indicates output type of the pin and equals 'O' character. |
static char |
PIN_UNKNOWN
The constant indicates unknown type of the pin and equals 'U' character. |
static char |
PIN_VCC
The constant indicates power supply type of the pin and equals 'V' character. |
protected char[] |
val
Array that defines values of pins. |
static char |
VAL_FALSE
The constant indicates low-level value of the pin and equals 'F' character. |
static char |
VAL_TRUE
The constant indicates high-level value of the pin and equals 'T' character. |
static char |
VAL_UNKNOWN
The constant indicates unknown value of the pin and equals 'U' character. |
static char |
VAL_ZSTATE
The constant indicates Z-state value of the pin and equals 'Z' character. |
| Constructor Summary | |
jeComponent(java.lang.String nam,
int number)
Constructor of the abstract component. |
|
| Method Summary | |
void |
error(java.lang.String s)
Print error message to console. |
boolean |
getBool(int n)
Get pin boolean value. |
int |
getInputs()
Get number of inputs. |
char |
getLogic(int n)
Get pin logic value. |
java.lang.String |
getName()
Get name of the component. |
int |
getOutputs()
Get number of outputs. |
char |
getPin(int n)
Get pin type. |
int |
getPins()
Get number of pins. |
char |
getVal(int n)
Get pin value. |
boolean |
isInput(int n)
Test pin for input by number. |
boolean |
isOutput(int n)
Test pin for output by number. |
void |
pullUp(boolean p)
Switch on or switch off flag of pull-up feature. |
void |
setBool(int n,
boolean v)
Set pin boolean value. |
void |
setLogic(int n,
char v)
Set pin logic value. |
void |
setPin(int n,
char t)
Set pin type. |
void |
setVal(int n,
char v)
Set pin value. |
abstract int |
step()
Do step of emulation. |
java.lang.String |
toString()
Convert object to string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String name
protected boolean flag_pullup
true so all unconnected inputs will be "1"
protected char[] pin
pin[0] is number of pins, so array has length pin[0]+1
and usually pin[0] must be equal val[0]
PIN_UNKNOWN,
PIN_INPUT,
PIN_OUTPUT,
PIN_OPEN,
PIN_VCC,
PIN_GND,
PIN_NCpublic static final char PIN_UNKNOWN
public static final char PIN_INPUT
public static final char PIN_OUTPUT
public static final char PIN_OPEN
public static final char PIN_VCC
public static final char PIN_GND
public static final char PIN_NC
protected char[] val
val[0] is number of values, so array has length val[0]+1
and usually val[0] must be equal pin[0]
VAL_UNKNOWN,
VAL_TRUE,
VAL_FALSE,
VAL_ZSTATEpublic static final char VAL_UNKNOWN
public static final char VAL_TRUE
public static final char VAL_FALSE
public static final char VAL_ZSTATE
| Constructor Detail |
public jeComponent(java.lang.String nam,
int number)
nam - a name of the component.number - a quantity of all pins of the component.| Method Detail |
public void error(java.lang.String s)
s - a message for printing.public void pullUp(boolean p)
p - true or false value.flag_pulluppublic java.lang.String getName()
namepublic int getPins()
pin
public void setPin(int n,
char t)
n - pin number (starts from 1)t - pin type charpin,
PIN_UNKNOWN,
PIN_INPUT,
PIN_OUTPUT,
PIN_OPEN,
PIN_VCC,
PIN_GND,
PIN_NCpublic char getPin(int n)
n - pin number (starts from 1)
pin,
PIN_UNKNOWN,
PIN_INPUT,
PIN_OUTPUT,
PIN_OPEN,
PIN_VCC,
PIN_GND,
PIN_NC
public void setVal(int n,
char v)
n - pin number (starts from 1)v - pin value charval,
VAL_UNKNOWN,
VAL_TRUE,
VAL_FALSE,
VAL_ZSTATE
public void setLogic(int n,
char v)
n - pin number (starts from 1)v - pin logic value charval,
VAL_UNKNOWN,
VAL_TRUE,
VAL_FALSE,
VAL_ZSTATE
public void setBool(int n,
boolean v)
n - pin number (starts from 1)v - pin boolean valuevalpublic char getVal(int n)
n - pin number (starts from 1)
val,
VAL_UNKNOWN,
VAL_TRUE,
VAL_FALSE,
VAL_ZSTATEpublic char getLogic(int n)
n - pin number (starts from 1)
val,
VAL_TRUE,
VAL_FALSEpublic boolean getBool(int n)
n - pin number (starts from 1)
valpublic int getInputs()
pinpublic int getOutputs()
pinpublic boolean isInput(int n)
n - pin number (starts from 1)
pinpublic boolean isOutput(int n)
n - pin number (starts from 1)
pinpublic java.lang.String toString()
toString in class java.lang.Objectpublic abstract int step()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||