private static Network INSTANCE = null; private Network(){ } static { INSTANCE = new Network(); } public static Network getInstance() { return INSTANCE; }
new Thread(new Runnable(){ public void run() { new Network().connect(); } }).start();
public Network build() { return new Network(name, description); }
public Network build() { return new Network(name, description); }
public Network build() { return new Network(name, description); }
public Network build() { return new Network(name, description); }
SimpleDataSource.init("database.properties"); net = new Network();
public class TestNetwork { public static void main(String[] args){ Network network = new Network("file.txt"); <-- create instance ArrayList<String> nodes = network.nodes; <-- reference the data ArrayList<String> edges = network.edges; for (String s : nodes) { <-- traverse data System.out.println(s); <-- print data } for (String s : edges){ System.out.println(s); } } }
public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv = (TextView)findViewById(R.id.text); Network network = new Network(); network.postData(tv); } }
try { JSONObject verifyKey = new Network().verifyKey(pinF.getText(), phoneF.getText(), mp); if (verifyKey != null) { String string = verifyKey.getString("ans");
final Network network = new Network(); Thread t1 = new Thread(new Runnable() { @Override public void run() { System.out.println("Thread started..."); try { network.changeConnection("connect"); } catch (Exception ex) { } } }); t1.start(); System.out.println("Thread start command executed..."); //Thread.sleep(20000); while(t1.isAlive()){ //Do nothing... } network.changeConnection("disconnect");
public static void main(String[] args) throws Exception { Thread t1 = new Thread(new Runnable() { @Override public void run() { try { Network network = new Network(); network.changeConnection("connect"); // Do loads of work... // All work has been done and we're done with the // connection. Why don't we close it just now? network.changeConnection("disconnect"); } catch (Exception exc) { // Catch the exception properly } } }); t1.start(); }
assertEquals(network.getType(), VCloudMediaType.NETWORKSECTION_XML); assertEquals(network.getInfo(), "The list of logical networks"); assertEquals(network.getNetworks(), ImmutableSet.of(new Network("vAppNet-vApp Internal", null)));