Example usage for java.lang String concat

List of usage examples for java.lang String concat

Introduction

In this page you can find the example usage for java.lang String concat.

Prototype

public String concat(String str) 

Source Link

Document

Concatenates the specified string to the end of this string.

Usage

From source file:es.juntadeandalucia.panelGestion.negocio.utiles.Geoserver.java

public static String getWFSGetCapabilitiesUrl(String wfsUrl) {
    GeoserverVO geoserverVO = Utils.getGeoserverVOByURL(wfsUrl);
    String wfsGetCapabilities = wfsUrl.concat("service=WFS&request=GetCapabilities&version=")
            .concat(geoserverVO.getGeoserverWFSVersion());

    return wfsGetCapabilities;
}

From source file:main.Draft_text_categorization.java

public static void news_categorization(String package_path) {

    Map<String, Integer> glossWithWeights = new HashMap<String, Integer>();
    Map<String, Double> resultados = new HashMap<String, Double>();
    int limit = 15;
    if (package_path.endsWith(".txt")) {
        limit = 1;//from   w  w  w .ja  v a  2 s. c om
    }
    double similaridad = 0.0;
    String tipoGlosario = "";

    Map.Entry<String, Double> maxEntry = null;

    for (int counter = 1; counter <= limit; counter++) {
        //2.1) eliminar las stop_words del documento
        //Obtenemos el documento que queremos categorizar
        String pathToFile = package_path;
        if (limit > 1) {
            pathToFile = pathToFile.concat(counter + ".txt");
        }
        Map<String, Integer> docWithWeights = docAsVectorToMap(pathToFile);

        for (int i = 1; i < 4; i++) {
            glossWithWeights = docAsVectorToMap("/clippings/glosario_" + i + ".txt");
            similaridad = cosine_similarity(docWithWeights, glossWithWeights);
            switch (i) {
            case 1:
                tipoGlosario = "DEPORTES";
                break;
            case 2:
                tipoGlosario = "ECONOMIA";
                break;
            case 3:
                tipoGlosario = "POLITICA";
                break;

            }
            resultados.put(tipoGlosario, similaridad);

            System.out.println("Similaridad de noticia " + package_path + counter + ".txt con glosario de "
                    + tipoGlosario + " = " + String.format("%.2f", similaridad * 100) + " %");
        }
        for (Entry<String, Double> resultado : resultados.entrySet()) {
            if (maxEntry == null || resultado.getValue().compareTo(maxEntry.getValue()) > 0) {
                maxEntry = resultado;
            }
        }
        if (maxEntry != null) {
            System.out.println(
                    "\nLa noticia " + package_path + counter + ".txt, es de categoria " + maxEntry.getKey()
                            + ", con un " + String.format("%.2f", maxEntry.getValue() * 100) + " %\n");
        }
    }
}

From source file:eu.optimis.service_manager.rest.util.ConfigManager.java

public static String getConfigFilePath(String configFile) throws Exception {
    String optimisHome = optimis_Home;
    if (optimisHome == null) {
        optimis_Home = System.getenv("OPTIMIS_HOME");
        optimisHome = "/opt/optimis";
        log.warn("Please set environment variable OPTIMIS_HOME. Using default /opt/optimis.");
    }/*from   www  . j  a  v a2 s  . c  om*/

    File fileObject = new File(optimisHome.concat(configFile));
    //If not exists, copy property files from the source code %OPTIMIS_HOME%
    if (!fileObject.exists()) {
        createDefaultConfigFile(fileObject);
    }

    return optimisHome.concat(configFile);
}

From source file:eu.optimis.sm.gui.utils.ConfigManager.java

public static String getFilePath(String configFile) {
    String optimisHome = optimis_Home;
    if (optimisHome == null) {
        optimis_Home = System.getenv("OPTIMIS_HOME");
        optimisHome = "/opt/optimis";
        log.warn("Please set environment variable OPTIMIS_HOME. Using default /opt/optimis");
    }//from  ww w  .j a  v  a 2  s.  c  om

    File fileObject = new File(optimisHome.concat(configFile));
    try {
        createDefaultConfigFile(fileObject);
    } catch (Exception ex) {
        log.error(
                "Error reading " + optimisHome.concat(configFile) + " configuration file: " + ex.getMessage());
        log.error(ex.getMessage());
    }
    return optimisHome.concat(configFile);
}

From source file:Similaridade.GraficosSimilaridade.java

public static JFreeChart criaGrafico2LinhasComDeslocada(CapturaAtual onda1, CapturaAtual onda2,
        int deslocamento, double correlacao, Paint cor1, Paint cor2) {
    String eixoy = new String("Current ");
    // verifica se  fase ou fuga
    if (onda1.getCodEvento().getCodEvento() == 1) { // evento 1  de fuga
        eixoy = eixoy.concat("(mA)");
    } else {/*from  w  w  w  . j a va  2 s . c om*/
        eixoy = eixoy.concat("(A)");
    }
    XYDataset dataset = newDataset2OndasComDeslocada(onda1, onda2, deslocamento, correlacao);

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            "Time (ms)", // x axis label
            eixoy, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            false, // tooltips
            false // urls
    );

    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();

    // Definindo valores no eixo y
    double min = (double) DatasetUtilities.findMinimumRangeValue(dataset);
    double max = (double) DatasetUtilities.findMaximumRangeValue(dataset);

    plot.getRangeAxis().setRange(min - min * 0.005, //min
            max + min * 0.005);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

    renderer.setBaseStroke(new BasicStroke(1.0f));
    for (int i = 0; i < dataset.getSeriesCount(); i++) {
        renderer.setSeriesLinesVisible(i, true);
        renderer.setSeriesShapesVisible(i, false);
    }
    // Ajustar para todas as cores padro, pelo menos 10
    renderer.setSeriesPaint(0, cor1);
    renderer.setSeriesPaint(1, cor2);

    /* Cdigo para ter linhas tracejadas 
    renderer.setSeriesStroke(1, 
        new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND,
                        20.0f, new float[] {5.0f}, 0.0f) );
               
    renderer.setDrawSeriesLineAsPath(true); 
    /* Final do Codigo para tracejadas */

    plot.setRenderer(renderer);

    return chart;
}

From source file:Main.java

public static String textFromFile(String filename) {

    String text = new String();
    String nextLine = new String();

    try {/* w ww .  ja va2  s .co m*/
        FileInputStream instream = new FileInputStream(filename);
        DataInputStream in = new DataInputStream(instream);

        BufferedReader buffered = new BufferedReader(new InputStreamReader(in));

        while ((nextLine = buffered.readLine()) != null) {
            text = text.concat(nextLine);
        }
    } catch (IOException e) {
        return null;
    }

    return text;
}

From source file:easycare.alc.service.report.HstPrescriptionReportBeanTest.java

public static void setupMockMessageSource(ApplicationMessageSource aMessageSource) {
    when(aMessageSource.getMessage(anyString())).thenAnswer(new Answer<String>() {
        @Override// w  ww.  java  2 s.  com
        public String answer(InvocationOnMock invocation) throws Throwable {
            return invocation.getArguments()[0] + ":{0}";
        }
    });

    when(aMessageSource.getMessage(anyString(), (Object[]) any())).thenAnswer(new Answer<String>() {
        @Override
        public String answer(InvocationOnMock invocation) throws Throwable {
            String messageKey = (String) invocation.getArguments()[0];
            Object[] args = (Object[]) invocation.getArguments()[1];
            String argList = "";
            for (Object o : args) {
                argList = argList.concat(o.toString() + ",");
            }
            return messageKey + ":" + argList;
        }
    });
    when(aMessageSource.getMessage("java.dateFormat")).thenReturn("dd/MM/yyyy");
    when(aMessageSource.getGenderMessage(Gender.MALE.name())).thenReturn(Gender.MALE.name().toLowerCase());
    when(aMessageSource.getMessage(JAVA_DATE_FORMAT_KEY)).thenReturn(DATE_FORMAT);
    when(aMessageSource.getMessage(JAVA_CLOCK_TIME_FORMAT_KEY)).thenReturn(TIME_FORMAT);
}

From source file:Main.java

/**
 * @param imgName//from   ww  w  .  j a va 2  s .c o m
 * @return
 */
public static Bitmap getBitmapFromPath(String imgName) {
    String sExtendSdcardDir = "";
    String sAppRoot = "";

    String sdcardRoot = Environment.getExternalStorageDirectory() == null ? ""
            : Environment.getExternalStorageDirectory().getAbsolutePath();
    Log.d("Tiny", "sdcardRoot --" + sdcardRoot);

    if (sdcardRoot != null) {
        sExtendSdcardDir = sdcardRoot;
        sAppRoot = sExtendSdcardDir.concat("/TINY");
    }

    String sCache = sAppRoot.concat("/cache");

    File file = new File(sCache);
    if (!file.exists()) {
        file.mkdirs();
    }
    Log.d("Tiny", "file path --" + file.getAbsolutePath());

    File image = new File(file.getAbsolutePath(), imgName);
    BitmapFactory.Options bmOptions = new BitmapFactory.Options();
    Bitmap bitmap = BitmapFactory.decodeFile(image.getAbsolutePath(), bmOptions);
    return bitmap;
}

From source file:de.ingrid.portal.global.UtilsFileHelper.java

/**
 * Generate a filename with type and title
 * /*  w  ww  .j ava  2 s. com*/
 * @param date
 * @param title
 * @param type
 * @return filename
 */
public static String generateFilename(String title, String type) {

    String filename;

    filename = title.concat(".").concat(type);

    if (title == null || type == null) {
        if (log.isErrorEnabled()) {
            log.error("Title: " + title + "or Type: " + type + " is null!");
        }
    }
    return filename;
}

From source file:eu.optimis.ip.gui.client.resources.ConfigManager.java

public static String getFilePath(String configFile) {
    String optimisHome = optimis_Home;
    if (optimisHome == null) {
        optimis_Home = System.getenv("OPTIMIS_HOME");
        optimisHome = "/opt/optimis";
        log.warn("Please set environment variable OPTIMIS_HOME. Using default /opt/optimis.");
    }/*from   w w w  . j ava 2  s  .  c  o m*/

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("Error reading " + optimisHome.concat(configFile) + " configuration file: "
                    + ex.getMessage());
            log.error(ex.getMessage());
        }
    }

    return optimisHome.concat(configFile);
}