This file contains hidden or 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 static void main(String[] args) { | |
Person person = new Person("Tom Criuse", 44); | |
modifyPerson(person); | |
System.out.println(person.getName()); | |
} | |
private static void modifyPerson(Person person) { | |
person.setName("Brad Pit"); |
This file contains hidden or 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 ReferenceTest { | |
public static void main(String[] args) { | |
Person person = new Person("Tom Criuse", 44); | |
System.out.println(person.getName()); | |
} | |
} |
This file contains hidden or 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 Person { | |
private String name; | |
private int age; | |
Person(String name, int age){ | |
this.name = name; | |
this.age = age; | |
} | |
public String getName() { |
This file contains hidden or 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
class TicketCounter extends Thread { | |
TicketingSystem ticketingSystem; | |
public TicketCounter(String name) { | |
this.setName(name); | |
start(); | |
} | |
@Override | |
public void run() { |
This file contains hidden or 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 static String getNextAvailableTicket() { | |
String availableNumber = null; | |
try { | |
synchronized(TicketingSystem.class){ | |
for (Ticket number: numberList) { | |
if(number.getStatus() == "open") { | |
number.setStatus("pending"); // changing the state of the object | |
System.out.printf("Thread name %s - number found %s \n",Thread.currentThread().getName(), number.getName()); |
This file contains hidden or 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
class TicketingSystem { | |
static final Ticket number1 = new Ticket("Number1", "open"); | |
static final Ticket number2 = new Ticket("Number2", "open"); | |
static Ticket[] numberList = new Ticket[] {number1, number2}; | |
public static synchronized String getNextAvailableTicket() { | |
String availableNumber = null; | |
try { |
This file contains hidden or 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
class Ticket { | |
private String name; | |
private String status; | |
public Ticket(String name, String status) { | |
this.name = name; | |
this.status = status; | |
} | |
This file contains hidden or 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.util.Arrays; | |
public class SyncExample { | |
public static void main(String[] args) { | |
try { | |
TicketingSystem ts = new TicketingSystem(); | |
TicketCounter tc1 = new TicketCounter(ts, "Thread 1"); | |
TicketCounter tc2 = new TicketCounter(ts, "Thread 2"); | |
This file contains hidden or 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
diff --git a/app/models/provider.rb b/app/models/provider.rb | |
index c468731..d4afb3a 100644 | |
--- a/app/models/provider.rb | |
+++ b/app/models/provider.rb | |
@@ -1,3 +1,4 @@ | |
class Provider < ApplicationRecord | |
has_many :customers, as: :company | |
+ has_many :tracking_events | |
end | |
diff --git a/app/models/shipper.rb b/app/models/shipper.rb |
This file contains hidden or 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
From 43bbfa63f3efa6b10abcd7454d2953cb37b9efc9 Mon Sep 17 00:00:00 2001 | |
From: Raghu <[email protected]> | |
Date: Mon, 15 Oct 2018 15:34:18 -0700 | |
Subject: [PATCH 1/2] Code challenge | |
--- | |
vue-spa/src/App.vue | 14 ++++++++++++-- | |
vue-spa/src/components/TrackableEvent.vue | 17 +++++++++++++++++ | |
2 files changed, 29 insertions(+), 2 deletions(-) | |
create mode 100644 vue-spa/src/components/TrackableEvent.vue |
NewerOlder