« first day (1863 days earlier)      last day (3090 days later) » 

5:02 AM
@albru123 you can achieve this..
 
 
1 hour later…
6:11 AM
i am starting a small IT Firm and i recently got a project to work for . can u please suggest which development platform will be better for starting my work.as i have no licensed copy of the VS2010 , whereas Java eclipse is free. Can u pls help me out
 
 
1 hour later…
7:20 AM
@SupriyoBhattacherjee The answer to your question is that it depends..
 
 
4 hours later…
11:11 AM
Hello, i'd need some help, anyone there?
 
@user3825614 shoot
 
I'm a newbye Java programmer, with very little OOP experience.. I was trying to start a project but i'm allready having so problems understanding what i should consider as classes, what as interfaces and so on
What i want to do is some simple "command line" logic circuit creator...
You know a bit about logic circuits?
 
If you have problems about understanding OOPs then better read a book first
 
Let's consider the "simplest" gate to implement, a NOT gate... So i'll have a class called NotGate which in someway every time that a imput A changes it outputs notA
No no, i understand OOP, but for now is just a little hard to understand what are best implement choices uding OOP...

Going on, the problem is, how do i update my NotGate object every time the imput changes?
 
@user3825614 Think of an object as a new type
There's int, there's String, and there's NotGate
Think of them as nouns in a sentence
 
11:24 AM
Yep, that is ok for me.. I don't have problems understanding what a class, an object, an interface etc are
 
@user3825614 In your particular case, NotGate doesn't sound like a very good candidate for class/object
Because a NotGate is pure
 
what do you mean "pure"?
 
Given any input A, NotGate will always produce the exact same result of !A
It has no internal state, no variables to keep track of, no properties.
For that reason, not() is better represented by a function
 
It will have a label if i want to draw it on a circuit, it will have an output that i will want to connect to other gates etc
I'm thinking about logical gates, not only boolean functions
 
@user3825614 Ah, in which case, it is an object
It has a visual representation and a connection to other entities
In addition to its functionality
 
11:28 AM
Yes
 
So for example, I'd implement two base classes
OneInputGate and TwoInputsGate
 
As one imput there is only the not gate but yes, that's right
input*
 
NotGate and NoopGate will inherit from OneInputGate, whereas AndGate and XorGate inherits from TwoInputsGate
OneInputGate and TwoInputsGate inherit from a higher, Gate class, which defines an abstract draw() method
 
That's ok for me man :) I really appreciate your help but that is not the part i have problems with
Let's talk about the NotGate, it will have an input, i could create a class called "Pin" and give that class a Pin reference as input
so the NotGate will read the inputPin state to calculate what state to give to the outputPin
 
@user3825614 Hmm, I don't think it needs to be an instance of Pin.
All Pins are drawn in the same way
The only thing the differentiates them from one another is their state, true or false.
Which is why it makes perfect sense for them to be booleans
Unless you have something in mind I'm not aware of?
 
11:35 AM
but they have labels, etc ^^ for example when i will give this project a GUI i want the user to hover the pin and read what that pin is (in a not gate is obvious but in a FlipFlop it isn't for example) and i want him to click on the pin and connect it to another pin etc..
And state can be "true, false, undefined, error", i used an Enum for state
 
Now, let's say i have two NotGates and i connect the output of notgate A to the input of notgate B
When A changes i want it to trigger a change on B
That is the hard part for me
 
@user3825614 Oh, that's actually easy
Let's say your Pin instance has two Connectable instances from each side
 
Uhm, Connectable?
 
@user3825614 Your own interface, that defines abstract methods for connecting two entities together
 
11:38 AM
another class?
ok
 
For that matter, it's something both Pin and Gate implement
When you have your changeState() method on your Pins
So all you need to do is something like this
public void changeState(State newState) {
  this.outputConnectable.notifyStateChange(newState);
  // Perform specific change actions here
}
Your Pin (or Connectable) has other Connectables as properties on the object
When their state change, they can notify the other instances that they're connected to by calling a method on them
 
But how does that notify "travel" form an object to another? How does the notgate B receives the notify?
notification*
 
Let's say you have this graph:
---->(not)---->
  A         B
A is connected to UserInput on one end (so that you can control it), and to the NotGate on the other.
The NotGate has A on one end, and B on the other.
B has the NotGate on the one end, and null on the other.
Are you seeing it now?
UserInput is a Connectable that listens to clicks or some other form of user input to change its state
When UserInput is updated, it calls the notifyStateChange() on A.
A decides what to do, in this case, change its own state, and notify the guy connected on the other end, which is the NotGate
NotGate receives that the input was changed, and changes the state of B to be !inputConnectable.getState()
(Again, I'm acting as if getState() is boolean, in your case you'll need a custom implementation)
Then, the B stateChange() method is called, so it decides what to do, change its own state and call the next guy in the chain. The next guy is null so the chain stops there.
 
yes, but "NotGates receives that the input was changed".. it should have a "listener" for the notification, but how?
 
@user3825614 No, it isn't a listener.
When A's state was changed, it called outputConnectable.inputChangedTo(this.getState())
 
11:51 AM
sorry, i'm haveing some troubles seeing, it... maybe when i'll understand it will be like "Oh, it was that easy?"
 
outputConnectable is the notGate.
notGate's inputChangedTo() method looks somewhat like this:
public void inputChangedTo(boolean newState) {
  this.outputConnectable.inputChangedTo(!newState);
}
 
Ok, wait, i'll read that all again, give me 2 mins :)
 
@user3825614 Do you know how a LinkedList works?
 
yes
 
@user3825614 A linked list is composed of Node<T>s, which have 2 properties, T value and Node<T> next
You traverse the list by getting the thisNode.next value
 
11:56 AM
Oooooooh, now i understand
 
This propagation of state is similar
 
so it simply call "next.update" in my circuit..
for example
 
@user3825614 Yes
Exactly.
Write a program that takes a LinkedList of Integers, and updates it so that each element is 1 larger than the original
How would you write that?
// probably something like
public increaseByOne() {
  this.value++;
  if (this.next != null) { this.next.increaseByOne(); }
}
 
Class Item with 2 propretis, int Value, Item next
Ok, that's a really simple way to do it, thank you
 
You're welcome :)
 
12:00 PM
Is there a way to give you an upvote? :')
Ok, thanks man, when my circuit simulator will be famous i will write your name somewhere in "special thanks to.."
:')
Cya
 
12:20 PM
@MadaraUchiha good work :)
 
 
1 hour later…
1:43 PM
@ItachiUchiha Is it possible by some other way than manually setting the heights for each element and the GridPane?
I have no idea how to do it...
 
2:04 PM
Morning, Java!
 
 
4 hours later…
5:35 PM
Off to lunch. Bye Java!
 
6:28 PM
@MadaraUchiha so lame. I have to ping @Zirak
 
@BenjaminGruenbaum See, the thing about being a mod is that I can erase all evidence
 
6:48 PM
@MadaraUchiha but I can still see it
 
@Gemtastic What can you see?
 
Foo
 
@Gemtastic I assume there was some stuff before that
 
Well, it's a removed comment, if there was something before that edit of that removed comment I can't see it then no.
 
fge
sigh JMH is way too complicated to setup
 
7:16 PM
Hey, is me, back to my logic simulator.. :)
I have an Interface and i want all the classes that implements it to have a X type reference, what is the best way to do this?

interface MyInterface {
public X myX;
}
that is not allowed, right?
 
7:54 PM
@user3825614 Interfaces only define expected behavior. No state and no implementation detail.
 
Hmm, i implemented it as an abstract class instead of interface and it is actually better this way
 
 
3 hours later…
11:27 PM
heyo how do I do something like this:
List<GeometryItem2D>{
@Override
public void equals(Object o)
{
}
}
items = Arrays.asList....(etc)
so I wanna make a new list object that uses a different equals method than the default one
 

« first day (1863 days earlier)      last day (3090 days later) »