Examples of SourceLoader


Examples of Translator.source.SourceLoader

public class TranslatorController {

    public static void main(String[] args) throws IOException {
        //initialization
        SourceLoader sourceLoader = new SourceLoader();
        Translator translator = new Translator(new URLSourceProvider());

        System.out.println("Выберите способ загрузки контента:");
        System.out.println("'url' - c интернет ресурса.");
        System.out.println("'file' - c локального файла.");
        System.out.println("'exit' - выход.");
        Scanner scanner = new Scanner(System.in);
        String command = scanner.next();
        while(!"exit".equals(command)) {
            String source = sourceLoader.loadSource(command);
            String translation = translator.translate(source);

            System.out.println("Original: " + source);
            System.out.println("Translation: " + translation.substring(81, translation.indexOf("</text>")));
View Full Code Here

Examples of com.geekhub.lessons.lessonFive.sourse.SourceLoader

import java.util.Scanner;

public class TranslatorController {

    public static void main(String[] args) throws IOException {
        SourceLoader sourceLoader = new SourceLoader();
        Translator translator = new Translator(new URLSourceProvider());
        System.out.println("Input source to translate or type 'exit' to exit...");
        Scanner scanner = new Scanner(System.in);
        String command = scanner.next();
        while (!"exit".equals(command)) try {
            String source = sourceLoader.loadSource(command);
            String translate = translator.translate(source);
            System.out.println("English text: \n" + source);
            System.out.println("Russian translation: \n" + translate);
            System.out.println("Input source to translate or type 'exit' to exit...");
            command = scanner.next();
View Full Code Here

Examples of com.google.test.metric.report.SourceLoader

  ByteArrayOutputStream out = new ByteArrayOutputStream();
  HypotheticalCostModel costModel = new HypotheticalCostModel(new CostModel());

  public void testExample() throws Exception {
    IssuesReporter reporter = new IssuesReporter(new LinkedList<ClassIssues>(), costModel);
    ReportModel model = new AboutTestabilityReport(reporter, new SourceLoader(null) {
      @Override
      public Source load(String name) {
        return new Source(asList(
            new Line(1, "Copyright garbage!"),
            new Line(2, "package com.google.test.metric.example;"),
View Full Code Here

Examples of com.google.test.metric.report.SourceLoader

      IssuesReporter issuesReporter = new IssuesReporter(
          new TriageIssuesQueue<ClassIssues>(maxAcceptableCost,
              maxClassesInReport, new ClassIssues.TotalCostComparator()), hypotheticalCostModel);
      ReportOptions options = new ReportOptions(cyclomaticCost, globalCost, constructorMultiplier,
          maxExcellentCost, maxAcceptableCost, maxClassesInReport, -1, -1, printDepth, -1, "", "");
      SourceLoader sourceLoader = new SourceLoader(classPath);

      AnalysisModel analysisModel = new AnalysisModel(issuesReporter);
      ReportModel reportModel = new HtmlReportModel(costModel, analysisModel, options);
      ReportGenerator report = new ReportGeneratorProvider(classPath, options,
          reportStream, hypotheticalCostModel, ReportFormat.html).build(costModel, reportModel, sourceLoader);
View Full Code Here

Examples of com.google.test.metric.report.SourceLoader

    CostModel costModel = new CostModel(options.getCyclomaticMultiplier(),
        options.getGlobalMultiplier(), options.getConstructorMultiplier());
    TriageIssuesQueue<ClassIssues> mostImportantIssues =
        new TriageIssuesQueue<ClassIssues>(options.getMaxExcellentCost(),
            options.getWorstOffenderCount(), new ClassIssues.TotalCostComparator());
    SourceLoader sourceLoader = new SourceLoader(classPath);

    IssuesReporter issuesReporter = new IssuesReporter(mostImportantIssues, hypotheticalCostModel);
    AnalysisModel analysisModel = new AnalysisModel(issuesReporter);
    ReportModel reportModel;
View Full Code Here

Examples of lesson05.source.SourceLoader

    public static void main(String[] args) throws IOException {

        //initialization

        SourceLoader sourceLoader = new SourceLoader();
        Translator translator = new Translator(new URLSourceProvider());

        Scanner scanner = new Scanner(System.in);
        System.out.println("Type <exit> or enter the path to a file that need to be translated: ");
        String command = scanner.next();

        while (!"exit".equals(command)) {

            //      So, the only way to stop the application is to do that manually or type "exit"
            // paths:
            // /home/av/Downloads/1.txt
            // https://dl.dropboxusercontent.com/u/14434019/en.txt

            try {
                String source = sourceLoader.loadSource(command);
                String translation = translator.translate(source);

                System.out.println("Original: " + source);
                System.out.println("Translation: " + translation);
View Full Code Here

Examples of org.auraframework.system.SourceLoader

        return namespaces;
    }

    public <D extends Definition> Source<D> getSource(DefDescriptor<D> descriptor) {
        LoaderKey key = new LoaderKey(descriptor.getNamespace(), descriptor.getPrefix());
        SourceLoader loader = loaders.get(key);
        if (loader == null) {
            return null;
        }
        return loader.getSource(descriptor);
    }
View Full Code Here

Examples of org.auraframework.system.SourceLoader

        return ret;
    }

    private <T extends Definition> Set<DefDescriptor<T>> find(Class<T> primaryInterface, String prefix, String namespace) {
        LoaderKey key = new LoaderKey(namespace, prefix);
        SourceLoader loader = loaders.get(key);
        if (loader == null) {
            throw new AuraRuntimeException(String.format("Loader not found for %s", key));
        }
        return loader.find(primaryInterface, prefix, namespace);
    }
View Full Code Here

Examples of org.auraframework.system.SourceLoader

    public SourceFactoryTest(String name) {
        super(name);
    }

    public void testSourceFactory() {
        SourceLoader loader = StringSourceLoader.getInstance();
        try {
            List<SourceLoader> loaders = Lists.newArrayList(loader, loader);
            new SourceFactory(loaders);
            fail("Should have failed with AuraException('Namespace claimed by 2 SourceLoaders')");
        } catch (AuraRuntimeException e) {
View Full Code Here

Examples of org.auraframework.system.SourceLoader

     * Verify that SourceFactory registers Privileged namespaces based on loader information.
     * SourceLoaders that implement PrivilegedNamespaceSourceLoaders are considered for determining if a namespace is privileged.
     * Namespaces served by SourceLoaders that do not implement PrivilegedNamespaceSourceLoaders are not privileged.
     */
    public void testPrivilegedNamespaceSourceLoadersAreRegisteredWithConfigAdapter(){
        SourceLoader friendlyLoader = new FriendlySourceLoader();
        SourceLoader selectiveLoader = new SelectiveSourceLoader();
        SourceLoader unprivilegedLoader = new UnprivilegedSourceLoader();
        List<SourceLoader> loaders = Lists.newArrayList(friendlyLoader, selectiveLoader, unprivilegedLoader);
        SourceFactory sf = new SourceFactory(loaders);
        assertEquals(Sets.newHashSet("VIP", "Guest", "Friend1", "Friend2", "Custom_1","Custom_2"), sf.getNamespaces());
       
        ConfigAdapter c = Aura.getConfigAdapter();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.