0% found this document useful (0 votes)
39 views1 page

Oop Labx Uml

The document describes an Adder class that uses various gate components like Generator, Gate, AndGate, OrGate, NotGate, and XORGate to perform addition. The Adder class contains methods to get the values of inputs A, B, Cin and output Cout, S. It also contains methods to set the values of inputs and print the truth table. The gate components implement an interface to calculate outputs based on connected input generators.

Uploaded by

MysticYogi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views1 page

Oop Labx Uml

The document describes an Adder class that uses various gate components like Generator, Gate, AndGate, OrGate, NotGate, and XORGate to perform addition. The Adder class contains methods to get the values of inputs A, B, Cin and output Cout, S. It also contains methods to set the values of inputs and print the truth table. The gate components implement an interface to calculate outputs based on connected input generators.

Uploaded by

MysticYogi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Adder

-a: Generator
-b: Generator
-cIn: Generator
-xor1: Gate
-xor2: Gate
-and1: Gate
-and2: Gate
-or: Gate
+Adder()
+printTruthTable(): void
+toChar(b:boolean): char
+getA(): boolean
+getB(): boolean
+getCin(): boolean
+getCout(): boolean
+getS(): boolean
<<interface>>
+setA(output:boolean): void
OutputCalculator +setB(output:boolean): void
AllInputsNotDefinedException
-connectedInputs +setCin(output:boolean): void +AllInputsNotDefinedException()
getOutput(): boolean
0..* +AllInputsNotDefinedException(msg:String)

3 5
Generator Gate
-output: boolean -connectedInputs: List<OutputCalculator>
+Generator(output:boolean) -requiredInputs: int
+getOutput(): boolean #Gate(requiredInputs:int)
+setOutput(output:boolean): void +numberOfInputs(): int
+getInput(index:int): OutputCalculator
+printTruthTable(): void
+connectTo(g:Gate)
+addInput(o:OutputCalculator): void
+removeInput(index:int): void
-toChar(b:boolean): char
-printTruth(g:Generator,gate:Gate): void
-printTruth(g1:Generator,g2:Generator,gate:Gate): void

AndGate OrGate NotGate XORGate


-REQUIRED_INPUTS: int -REQUIRED_INPUTS: int -REQUIRED_INPUTS: int -REQUIRED_INPUTS: int
+AndGate() +OrGate() +NotGate() +XORGate()
+getOutput(): boolean +getOutput(): boolean +getOutput(): boolean +getOutput(): boolean

You might also like