Package com.caucho.util

Examples of com.caucho.util.IntMap


  {
    CharBuffer line = CharBuffer.allocate();
    String topId = null;
    int count = 1;
    WriteStream ws = null;
    IntMap messages = new IntMap();

    try {
      while (true) {
        do {
          line.clear();
          if (! is.readLine(line)) {
            if (ws != null)
              ws.println("</message>");
            return false;
          }
          if (ws != null && ! line.startsWith("From ")) {
            for (int i = 0; i < line.length(); i++) {
              char ch = line.charAt(i);
              if (ch == '<')
                ws.print("&lt;");
              else
                ws.print(ch);
            }
            ws.println();
          }
        } while (! line.startsWith("From "));

        if (ws != null) {
          ws.println("</message>");
          ws.close();
          ws = null;
        }


        String date = null;
        String subject = null;
        String from = null;
        String id = null;
        String references = null;

        do {
          line.clear();
          if (! is.readLine(line))
            return false;
          if (line.length() == 0)
            break;

          String lower = line.toString().toLowerCase();

          if (lower.startsWith("subject: ")) {
            subject = line.substring("subject: ".length()).trim();

            if (subject.toLowerCase().startsWith("re:"))
              subject = subject.substring(3).trim();
          }
          else if (lower.startsWith("from: ")) {
            from = line.substring("from: ".length());
          }
          else if (lower.startsWith("date: ")) {
            date = line.substring("from: ".length());
          }
        } while (line.length() > 0);

        int index = messages.get(subject);

        if (index >= 0) {
          ws = dst.lookup("" + index + ".xtp").openAppend();
        }
        else {
          if (subject != null && ! subject.equals(""))
            messages.put(subject, count);

          ws = dst.lookup("" + count++ + ".xtp").openWrite();
          ws.println("<title>" + subject + "</title>");
        }
        ws.println("<em>" + from + "</em>");
View Full Code Here


    return _xmlEntities;
  }

  protected XmlEntities()
  {
    _entities = new IntMap();
    _entities.put("lt", '<');
    _entities.put("gt", '>');
    _entities.put("amp", '&');
    _entities.put("quot", '"');
    _entities.put("apos", '\'');
View Full Code Here

    //compiler.setEncoding("utf8");
    Path workPath = CauchoSystem.getWorkPath();
   
    dest = workPath.lookup(name.replace('.', '/') + ".java");

    hasDispatch = new IntMap();
    staticHasDispatch = new IntMap();
    setDispatch = new IntMap();
    staticSetDispatch = new IntMap();
    methodDispatch = new IntMap();
    staticMethodDispatch = new IntMap();
    namedProperties = new HashMap();
   
    overloadDispatch = new ArrayList();

    try {
View Full Code Here

    return _xmlEntities;
  }

  protected XmlEntities()
  {
    _entities = new IntMap();
    _entities.put("lt", '<');
    _entities.put("gt", '>');
    _entities.put("amp", '&');
    _entities.put("quot", '"');
    _entities.put("apos", '\'');
View Full Code Here

  void addFunction(Function function)
  {
    if (functions == null) {
      functions = new ArrayList();
      funMap = new IntMap();
    }
    int pos = funMap.get(function.id);

    if (pos < 0) {
      funMap.put(function.id, functions.size());
View Full Code Here

  return arg.toObject();

    case TO_SOURCE:
      arg = eval.getThis();
      Global.getGlobalProto().clearMark();
      IntMap map = new IntMap();

      arg.toSource(map, true);
      return arg.toSource(map, false);

    case WATCH:
View Full Code Here

      _staticClassWraps = new LruCache<Class,ESBase>(256);
      ESId.intern("foo"); // XXX: bogus to fix stupid kaffe static init.
    }
    */

    propertyMap = new IntMap();
    propertyMap.put(ESId.intern("Object"), OBJECT);
    propertyMap.put(ESId.intern("Function"), FUNCTION);
    propertyMap.put(ESId.intern("Array"), ARRAY);
    propertyMap.put(ESId.intern("String"), STRING);
    propertyMap.put(ESId.intern("Boolean"), BOOL);
View Full Code Here

    }
  }

  protected HtmlEntities(double version)
  {
    _entityToChar = new IntMap();
    initLatin1();
    if (version >= 4.0) {
      initSymbol();
      initSpecial();
    }
View Full Code Here

    _os.println("SMAP");
    _os.println(lineMap.getDestFilename());
    _os.println(_sourceType);
    _os.println("*S " + _sourceType);

    IntMap fileMap = new IntMap();

    _os.println("*F");
    Iterator<LineMap.Line> iter = lineMap.iterator();
    while (iter.hasNext()) {
      LineMap.Line line = iter.next();

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);
      if (index < 0) {
        index = fileMap.size() + 1;
        fileMap.put(filename, index);

        if (filename.indexOf('/') >= 0) {
          int p = filename.lastIndexOf('/');

          _os.println("+ " + index + " " + filename.substring(p + 1));
          // XXX: _os.println(filename);

    if (filename.startsWith("/"))
      _os.println(filename.substring(1));
    else
      _os.println(filename);
        }
        else
          _os.println(index + " " + filename);
      }
    }
   
    _os.println("*L");
    int size = lineMap.size();
    int lastIndex = 0;
    for (int i = 0; i < size; i++) {
      LineMap.Line line = lineMap.get(i);

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);

      String fileMarker = "";

      _os.print(line.getSourceLine());
      _os.print("#" + index);
View Full Code Here

    _os.println("SMAP");
    _os.println(lineMap.getDestFilename());
    _os.println(_sourceType);
    _os.println("*S " + _sourceType);

    IntMap fileMap = new IntMap();

    _os.println("*F");
    Iterator<LineMap.Line> iter = lineMap.iterator();
    while (iter.hasNext()) {
      LineMap.Line line = iter.next();

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);
      if (index < 0) {
        index = fileMap.size() + 1;
        fileMap.put(filename, index);

        if (filename.indexOf('/') >= 0) {
          int p = filename.lastIndexOf('/');

          _os.println("+ " + index + " " + filename.substring(p + 1));
          // XXX: _os.println(filename);

          if (filename.startsWith("/"))
            _os.println(filename.substring(1));
          else
            _os.println(filename);
        }
        else
          _os.println(index + " " + filename);
      }
    }
   
    _os.println("*L");
    int size = lineMap.size();
    for (int i = 0; i < size; i++) {
      LineMap.Line line = lineMap.get(i);

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);

      _os.print(line.getSourceLine());
      _os.print("#" + index);

      if (line.getRepeatCount() > 1)
View Full Code Here

TOP

Related Classes of com.caucho.util.IntMap

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.