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
| @Path("/sakila") | |
| public class SakilaResource { | |
| @Context | |
| private SearchContext searchContext; | |
| List<Actor> actors = new ArrayList<Actor>(); | |
| List<Film> films = new ArrayList<Film>(); | |
| List<Rental> rentals = new ArrayList<Rental>(); |
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 SakilaSearchTest { | |
| static Server server; | |
| @BeforeClass | |
| public static void setUp() { | |
| JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); | |
| sf.setResourceClasses(SakilaResource.class); | |
| sf.getInInterceptors().add(new LoggingInInterceptor()); | |
| sf.getOutInterceptors().add(new LoggingOutInterceptor()); |
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
| package oscon.java.parallel; | |
| import extra166y.Ops; | |
| import extra166y.ParallelArray; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.List; | |
| public class GoingParallelInJava { |
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
| Factory factory = Factory.makeInstance(); | |
| EngineHelper helper = factory.makeEngineHelper(); | |
| FlowChart flowChart = helper.makeFlowChart("SCP Action Example"); | |
| SCPActionFactory scpActionFactory = (SCPActionFactory) flowChart.makeFactory("SCPActionFactory"); | |
| SCPAction downloadFile = scpActionFactory.makeSCPAction("SCP Download"); | |
| downloadFile.setHost("arul-ubuntu"); | |
| downloadFile.setUsername(System.getProperty("user.name")); | |
| downloadFile.setDownload(true); | |
| downloadFile.setRemotePath("Downloads/jdk-1_5_0_22-linux-i586.bin"); | |
| downloadFile.setLocalPath("/tmp/"); |
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 FunctionTest { | |
| FunctionTest(this.myFunc); | |
| Function myFunc; | |
| num run(num n) { | |
| return myFunc(n); | |
| } | |
| } | |
| main() { | |
| var square = (aNumber) => aNumber * aNumber; | |
| var result = new FunctionTest(square).run(5); |
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 Printer { | |
| Printer(this.address); | |
| noSuchMethod(String name, List args) { | |
| print("not implemented."); | |
| } | |
| var address; | |
| } | |
| main() { | |
| var p = new Printer("10.0.0.5:1234"); |
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
| main() { | |
| var user = 'John Doe'; | |
| var message = """ | |
| $user! | |
| Welcome to Programming Dart! | |
| """; | |
| print(message); | |
| } |
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
| main() { | |
| print(new List<String>() is <Object>();//true | |
| print(new List<Object>() is List<String>);//false | |
| print(new List<String>() is List<int>);//false | |
| print(new List<String>() is List);//true | |
| print(new Map() is Map<String,String>);//true | |
| } |
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 Complex { | |
| Complex(this.re, this.im); | |
| double re, im; | |
| operator +(Complex other) { | |
| return new Complex(re + other.re, im + other.im); | |
| } | |
| void Display( ) { | |
| print('$re,$im'); | |
| } | |
| } |
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
| main() { | |
| test(var a, [b = 54]) { | |
| print(b); | |
| } | |
| test(10); | |
| } |
OlderNewer