Package com.google.common.base

Examples of com.google.common.base.Splitter


    return createPrefix(groupId, relevantArtifactId);
  }

  @Nonnull
  private static String createPrefix(@Nonnull String relevantGroupId, @Nonnull String relevantArtifactId) {
    Splitter splitter = Splitter.on(new PackageSeparatorCharMatcher());

    List<String> partsList = Lists.newArrayList(splitter.split(relevantGroupId));
    partsList.addAll(Lists.<String>newArrayList(splitter.split(relevantArtifactId)));


    return Joiner.on(File.separator).join(partsList);
  }
View Full Code Here


    return createPrefix(groupId, relevantArtifactId);
  }

  @Nonnull
  private static String createPrefix(@Nonnull String relevantGroupId, @Nonnull String relevantArtifactId) {
    Splitter splitter = Splitter.on(new PackageSeparatorCharMatcher());

    List<String> partsList = Lists.newArrayList(splitter.split(relevantGroupId));
    partsList.addAll(Lists.<String>newArrayList(splitter.split(relevantArtifactId)));


    return Joiner.on(File.separator).join(partsList);
  }
View Full Code Here

        return configFolder;
    }

    @Mod.EventHandler
    public void processIMCRequests(FMLInterModComms.IMCEvent event) {
        Splitter splitter = Splitter.on("@").trimResults();
        for (FMLInterModComms.IMCMessage mess : event.getMessages()) {
            if (mess.key.equals("ballast")) {
                String[] tokens = Iterables.toArray(splitter.split(mess.getStringValue()), String.class);
                if (tokens.length != 2) {
                    Game.log(Level.WARN, String.format("Mod %s attempted to register a ballast, but failed: %s", mess.getSender(), mess.getStringValue()));
                    continue;
                }
                String blockName = tokens[0];
                Integer metadata = Ints.tryParse(tokens[1]);
                if (blockName == null || metadata == null) {
                    Game.log(Level.WARN, String.format("Mod %s attempted to register a ballast, but failed: %s", mess.getSender(), mess.getStringValue()));
                    continue;
                }
                BallastRegistry.registerBallast(Block.getBlockFromName(blockName), metadata);
                Game.log(Level.INFO, String.format("Mod %s registered %s as a valid ballast", mess.getSender(), mess.getStringValue()));
            } else if (mess.key.equals("boiler-fuel-liquid")) {
                String[] tokens = Iterables.toArray(splitter.split(mess.getStringValue()), String.class);
                if (tokens.length != 2) {
                    Game.log(Level.WARN, String.format("Mod %s attempted to register a liquid Boiler fuel, but failed: %s", mess.getSender(), mess.getStringValue()));
                    continue;
                }
                Fluid fluid = FluidRegistry.getFluid(tokens[0]);
View Full Code Here

        out.write(pad + "# " + name + NEW_LINE);

        if (comment != null)
        {
            out.write(pad + "#===================" + NEW_LINE);
            Splitter splitter = Splitter.onPattern("\r?\n");

            for (String line : splitter.split(comment))
            {
                out.write(pad + "# " + line + NEW_LINE);
            }
        }

        out.write(pad + "####################" + NEW_LINE + NEW_LINE);

        if (!allowedProperties.matchesAllOf(name))
        {
            name = '"' + name + '"';
        }

        out.write(pad + name + " {" + NEW_LINE);

        pad = getIndent(indent + 1);

        Property[] props = properties.values().toArray(new Property[properties.size()]);

        for (int x = 0; x < props.length; x++)
        {
            Property prop = props[x];

            if (prop.comment != null)
            {
                if (x != 0)
                {
                    out.newLine();
                }

                Splitter splitter = Splitter.onPattern("\r?\n");
                for (String commentLine : splitter.split(prop.comment))
                {
                    out.write(pad + "# " + commentLine + NEW_LINE);
                }
            }
View Full Code Here

    @NonNull
    public List<File> getProguardFiles() {
        if (mProguardFiles == null) {
            List<File> files = new ArrayList<File>();
            if (mProguardPath != null) {
                Splitter splitter = Splitter.on(CharMatcher.anyOf(":;")); //$NON-NLS-1$
                for (String path : splitter.split(mProguardPath)) {
                    if (path.contains("${")) { //$NON-NLS-1$
                        // Don't analyze the global/user proguard files
                        continue;
                    }
                    File file = new File(path);
View Full Code Here

    if (comment != null) {
      out.write(pad);
      out.write("#===================");
      out.newLine();
      Splitter splitter = Splitter.onPattern("\r?\n");

      for (String line : splitter.split(comment)) {
        out.write(pad);
        out.write("# ");
        out.write(line);
        out.newLine();
      }
    }

    out.write(pad);
    out.write("####################");
    out.newLine();
    out.newLine();

    if (!allowedProperties.matchesAllOf(name)) {
      name = '"' + name + '"';
    }

    out.write(pad);
    out.write(name);
    out.write(" {");
    out.newLine();

    pad = getIndent(indent + 1);

    Property[] props = properties.values().toArray(new Property[properties.size()]);

    for (int x = 0; x < props.length; x++) {
      Property prop = props[x];

      if (prop.comment != null) {
        if (x != 0) {
          out.newLine();
        }

        for (String commentLine : splitter.split(prop.comment)) {
          out.write(pad);
          out.write("# ");
          out.write(commentLine);
          out.newLine();
        }
View Full Code Here

  }

  public static void processAddFacadeIMC(IMCEvent event, IMCMessage m) {
    try {
      if (m.isStringMessage()) {
        Splitter splitter = Splitter.on("@").trimResults();

        String[] array = Iterables.toArray(splitter.split(m.getStringValue()), String.class);
        if (array.length != 2) {
          BCLog.logger.info(String.format("Received an invalid add-facade request %s from mod %s", m.getStringValue(), m.getSender()));
        } else {
          String blockName = array[0];
          Integer metaId = Ints.tryParse(array[1]);
View Full Code Here

            CharSource srgSource = zis.asCharSource(Charsets.UTF_8);
            List<String> srgList = srgSource.readLines();
            rawMethodMaps = Maps.newHashMap();
            rawFieldMaps = Maps.newHashMap();
            Builder<String, String> builder = ImmutableBiMap.<String,String>builder();
            Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults();
            for (String line : srgList)
            {
                String[] parts = Iterables.toArray(splitter.split(line),String.class);
                String typ = parts[0];
                if ("CL".equals(typ))
                {
                    parseClass(builder, parts);
                }
View Full Code Here

            CharSource srgSource = zis.asCharSource(Charsets.UTF_8);
            List<String> srgList = srgSource.readLines();
            rawMethodMaps = Maps.newHashMap();
            rawFieldMaps = Maps.newHashMap();
            Builder<String, String> builder = ImmutableBiMap.<String,String>builder();
            Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults();
            for (String line : srgList)
            {
                String[] parts = Iterables.toArray(splitter.split(line),String.class);
                String typ = parts[0];
                if ("CL".equals(typ))
                {
                    parseClass(builder, parts);
                }
View Full Code Here

TOP

Related Classes of com.google.common.base.Splitter

Copyright © 2018 www.massapicom. 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.