コード例 #1
1
ファイル: PCNode.java プロジェクト: shahidminhas/abc
 public Set /*<PCNode>*/ matchClass(Pattern simple_name_pattern) {
   Set this_class = matchSpecific(simple_name_pattern);
   Set this_class_names = new HashSet();
   Iterator tsi = this_class.iterator();
   while (tsi.hasNext()) {
     PCNode pc = (PCNode) tsi.next();
     this_class_names.add(pc.name);
   }
   Iterator pi = parents.iterator();
   while (pi.hasNext()) {
     PCNode parent = (PCNode) pi.next();
     // System.out.println("Parent: "+parent);
     Set parent_class = parent.matchClass(simple_name_pattern);
     Iterator osi = parent_class.iterator();
     while (osi.hasNext()) {
       PCNode pc = (PCNode) osi.next();
       if (!this_class_names.contains(pc.name)) {
         this_class.add(pc);
       }
     }
   }
   if (abc.main.Debug.v().namePatternProcessing)
     System.out.println(this + ".matchClass " + simple_name_pattern.pattern() + ": " + this_class);
   return this_class;
 }
コード例 #2
0
 protected void checkLeaf(SimulatedArchivalUnit sau) {
   log.debug("checkLeaf()");
   String parent = sau.getUrlRoot() + "/branch1";
   CachedUrlSetSpec spec = new RangeCachedUrlSetSpec(parent);
   CachedUrlSet set = sau.makeCachedUrlSet(spec);
   Iterator setIt = set.contentHashIterator();
   ArrayList childL = new ArrayList(16);
   while (setIt.hasNext()) {
     childL.add(((CachedUrlSetNode) setIt.next()).getUrl());
   }
   String[] expectedA =
       new String[] {
         parent,
         parent + "/001file.html",
         parent + "/001file.txt",
         parent + "/002file.html",
         parent + "/002file.txt",
         parent + "/branch1",
         parent + "/branch1/001file.html",
         parent + "/branch1/001file.txt",
         parent + "/branch1/002file.html",
         parent + "/branch1/002file.txt",
         parent + "/branch1/index.html",
         parent + "/branch2",
         parent + "/branch2/001file.html",
         parent + "/branch2/001file.txt",
         parent + "/branch2/002file.html",
         parent + "/branch2/002file.txt",
         parent + "/branch2/index.html",
         parent + "/index.html",
       };
   assertIsomorphic(expectedA, childL);
 }
コード例 #3
0
  protected void checkRoot(SimulatedArchivalUnit sau) {
    log.debug("checkRoot()");
    CachedUrlSet set = sau.getAuCachedUrlSet();
    Iterator setIt = set.flatSetIterator();
    ArrayList childL = new ArrayList(1);
    CachedUrlSet cus = null;
    while (setIt.hasNext()) {
      cus = (CachedUrlSet) setIt.next();
      childL.add(cus.getUrl());
    }

    String urlRoot = sau.getUrlRoot();

    String[] expectedA = new String[1];
    expectedA[0] = urlRoot;
    assertIsomorphic(expectedA, childL);

    setIt = cus.flatSetIterator();
    childL = new ArrayList(7);
    while (setIt.hasNext()) {
      childL.add(((CachedUrlSetNode) setIt.next()).getUrl());
    }

    expectedA =
        new String[] {
          urlRoot + "/001file.html",
          urlRoot + "/001file.txt",
          urlRoot + "/002file.html",
          urlRoot + "/002file.txt",
          urlRoot + "/branch1",
          urlRoot + "/branch2",
          urlRoot + "/index.html"
        };
    assertIsomorphic(expectedA, childL);
  }
コード例 #4
0
  protected String getRallyAPIError(String responseXML) {
    String errorMsg = "";

    try {

      org.jdom.input.SAXBuilder bSAX = new org.jdom.input.SAXBuilder();
      org.jdom.Document doc = bSAX.build(new StringReader(responseXML));
      Element root = doc.getRootElement();

      XPath xpath = XPath.newInstance("//Errors");
      List xlist = xpath.selectNodes(root);

      Iterator iter = xlist.iterator();
      while (iter.hasNext()) {

        Element item = (Element) iter.next();
        errorMsg = item.getChildText("OperationResultError");
      }

    } catch (Exception e) {
      errorMsg = e.toString();
    }

    return errorMsg;
  }
コード例 #5
0
    public boolean hasNext() {
      if (nextProc != null) return true;
      else {
        if (!names.hasNext()) return false;
        else {
          String processorName = names.next();

          Processor processor;
          try {
            try {
              processor = (Processor) (processorCL.loadClass(processorName).newInstance());
            } catch (ClassNotFoundException cnfe) {
              log.error("proc.processor.not.found", processorName);
              return false;
            } catch (ClassCastException cce) {
              log.error("proc.processor.wrong.type", processorName);
              return false;
            } catch (Exception e) {
              log.error("proc.processor.cant.instantiate", processorName);
              return false;
            }
          } catch (ClientCodeException e) {
            throw e;
          } catch (Throwable t) {
            throw new AnnotationProcessingError(t);
          }
          nextProc = processor;
          return true;
        }
      }
    }
コード例 #6
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 private void rm(Channel chan) {
   synchronized (chls) {
     for (Iterator<DarkChannel> i = chls.iterator(); i.hasNext(); ) {
       DarkChannel c = i.next();
       if (c.chan == chan) i.remove();
     }
   }
 }
コード例 #7
0
 public Map<String, String> getFormatSpecifierDescriptions() {
   Map<String, String> m = new LinkedHashMap<String, String>();
   Iterator<String> keys = scoreBoardValues.keySet().iterator();
   while (keys.hasNext()) {
     String k = keys.next();
     m.put(k, scoreBoardValues.get(k).getDescription());
   }
   return m;
 }
コード例 #8
0
 /**
  * Run all remaining processors on the procStateList that have not already run this round with
  * an empty set of annotations.
  */
 public void runContributingProcs(RoundEnvironment re) {
   if (!onProcInterator) {
     Set<TypeElement> emptyTypeElements = Collections.emptySet();
     while (innerIter.hasNext()) {
       ProcessorState ps = innerIter.next();
       if (ps.contributed) callProcessor(ps.processor, emptyTypeElements, re);
     }
   }
 }
コード例 #9
0
  /**
   * Finds the original field name(s), appending the first one to the out line, and any additional
   * alternatives to the extra lines.
   */
  private void originalFieldName(
      String className,
      String obfuscatedFieldName,
      String type,
      StringBuffer outLine,
      List extraOutLines) {
    int extraIndent = -1;

    // Class name -> obfuscated field names.
    Map fieldMap = (Map) classFieldMap.get(className);
    if (fieldMap != null) {
      // Obfuscated field names -> fields.
      Set fieldSet = (Set) fieldMap.get(obfuscatedFieldName);
      if (fieldSet != null) {
        // Find all matching fields.
        Iterator fieldInfoIterator = fieldSet.iterator();
        while (fieldInfoIterator.hasNext()) {
          FieldInfo fieldInfo = (FieldInfo) fieldInfoIterator.next();
          if (fieldInfo.matches(type)) {
            // Is this the first matching field?
            if (extraIndent < 0) {
              extraIndent = outLine.length();

              // Append the first original name.
              if (verbose) {
                outLine.append(fieldInfo.type).append(' ');
              }
              outLine.append(fieldInfo.originalName);
            } else {
              // Create an additional line with the proper
              // indentation.
              StringBuffer extraBuffer = new StringBuffer();
              for (int counter = 0; counter < extraIndent; counter++) {
                extraBuffer.append(' ');
              }

              // Append the alternative name.
              if (verbose) {
                extraBuffer.append(fieldInfo.type).append(' ');
              }
              extraBuffer.append(fieldInfo.originalName);

              // Store the additional line.
              extraOutLines.add(extraBuffer);
            }
          }
        }
      }
    }

    // Just append the obfuscated name if we haven't found any matching
    // fields.
    if (extraIndent < 0) {
      outLine.append(obfuscatedFieldName);
    }
  }
コード例 #10
0
 List<String> auUrls(ArchivalUnit au) {
   List<String> res = new ArrayList<String>();
   for (Iterator iter = au.getAuCachedUrlSet().contentHashIterator(); iter.hasNext(); ) {
     CachedUrlSetNode cusn = (CachedUrlSetNode) iter.next();
     if (cusn.hasContent()) {
       res.add(cusn.getUrl());
     }
   }
   return res;
 }
コード例 #11
0
ファイル: ShowComp.java プロジェクト: vishalshar/NetMon
  public ShowComp() throws InterruptedException, IOException {
    super("CONNECTED COMPUTERS");
    int x = 0, d = 20;
    mb = new JMenuBar();
    File = new JMenu("File");
    mb.add(File);
    exit = new JMenuItem("Exit");
    exit.addActionListener(this);
    File.add(exit);
    ta = new JTextArea();
    ta.setBounds(20, 30, 315, 470);
    ta.setEditable(false);
    add(ta);

    setJMenuBar(mb);

    sel = new JLabel("The connected computers are..");
    sel.setBounds(15, 5, 300, 30);
    add(sel);
    b1 = new JButton("<< BACK");
    b1.setBounds(140, 510, 100, 30);
    b1.setToolTipText("Back to main page");
    b1.addActionListener(this);
    add(b1);
    setLayout(null);
    while (x < 360) {
      x = x + d;
      setBounds(675, 50, x, 600);
      this.show();
    }
    // setVisible(true);
    String s = "192.168.0.", temp = null;
    Printer printer = new Printer();
    printer.start();
    Connector connector = new Connector(printer);
    connector.start();

    LinkedList targets = new LinkedList();
    for (int i = 1; i <= 255; i++) {
      temp = s + Integer.toString(i);
      Target t = new Target(temp);
      targets.add(t);
      connector.add(t);
    }
    Thread.sleep(2000);
    connector.shutdown();
    connector.join();

    for (Iterator i = targets.iterator(); i.hasNext(); ) {
      Target t = (Target) i.next();
      if (!t.shown) t.show();
    }

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  }
コード例 #12
0
ファイル: Macro.java プロジェクト: bramk/bnd
  String filter(String[] args, boolean include) {
    verifyCommand(args, String.format(_filterHelp, args[0]), null, 3, 3);

    Collection<String> list = new ArrayList<String>(Processor.split(args[1]));
    Pattern pattern = Pattern.compile(args[2]);

    for (Iterator<String> i = list.iterator(); i.hasNext(); ) {
      if (pattern.matcher(i.next()).matches() == include) i.remove();
    }
    return Processor.join(list);
  }
コード例 #13
0
ファイル: ChatRoomQuery.java プロジェクト: vincentlao/jitsi
  @Override
  protected void run() {
    Iterator<ChatRoomProviderWrapper> chatRoomProviders = mucService.getChatRoomProviders();

    while (chatRoomProviders.hasNext()) {
      ChatRoomProviderWrapper provider = chatRoomProviders.next();
      providerAdded(provider, true);
    }

    if (getStatus() != QUERY_CANCELED) setStatus(QUERY_COMPLETED);
  }
コード例 #14
0
ファイル: ChatRoomQuery.java プロジェクト: vincentlao/jitsi
 /**
  * Returns the index of the contact in the contact results list.
  *
  * @param contact the contact.
  * @return the index of the contact in the contact results list.
  */
 public synchronized int indexOf(ChatRoomSourceContact contact) {
   Iterator<ChatRoomSourceContact> it = contactResults.iterator();
   int i = 0;
   while (it.hasNext()) {
     if (contact.equals(it.next())) {
       return i;
     }
     i++;
   }
   return -1;
 }
コード例 #15
0
 public String getDocString() {
   StringBuffer buf = new StringBuffer();
   buf.append("Example data: ");
   for (Iterator<String> it = sampleStrs.iterator(); it.hasNext(); ) {
     String tokStr = it.next();
     buf.append("'" + tokStr + "'");
     if (it.hasNext()) {
       buf.append(", ");
     }
   }
   return buf.toString();
 }
コード例 #16
0
  public List getUserList() {
    List<Map> list = new ArrayList<Map>();

    try {

      /*
      String apiUrl=rallyApiHost+"/user?query="+
      	"((TeamMemberships%20%3D%20https%3A%2F%2Frally1.rallydev.com%2Fslm%2Fwebservice%2F1.34%2Fproject%2F6169133135)%20or%20"+
      	"(TeamMemberships%20%3D%20https%3A%2F%2Frally1.rallydev.com%2Fslm%2Fwebservice%2F1.34%2Fproject%2F6083311244))"+
      	"&fetch=true&order=Name&start=1&pagesize=100";
      */

      String apiUrl =
          rallyApiHost
              + "/user?query=(Disabled%20=%20false)"
              + "&fetch=true&order=Name&start=1&pagesize=100";

      log.info("apiUrl=" + apiUrl);

      String responseXML = getRallyXML(apiUrl);

      org.jdom.input.SAXBuilder bSAX = new org.jdom.input.SAXBuilder();
      org.jdom.Document doc = bSAX.build(new StringReader(responseXML));
      Element root = doc.getRootElement();

      XPath xpath = XPath.newInstance("//Object");
      List xlist = xpath.selectNodes(root);

      Iterator iter = xlist.iterator();
      while (iter.hasNext()) {

        Map map = new HashMap();

        Element item = (Element) iter.next();

        String userRef = item.getAttribute("ref").getValue();
        String userName = item.getAttribute("refObjectName").getValue();
        String userObjectId = item.getChildText("ObjectID");

        map.put("userRef", userRef);
        map.put("userObjectId", userObjectId);
        map.put("userName", userName);

        list.add(map);
      }

    } catch (Exception ex) {
      log.error("", ex);
    }

    return list;
  }
コード例 #17
0
ファイル: EBNF.java プロジェクト: meatlover/pai
  @Override
  public String toString() {
    Set<NonTerminal> nts = getNonTerminals();
    Iterator<NonTerminal> i = nts.iterator();
    String s = "";
    String start = getNonTerminalDef(getStartSymbol()) + "\n";

    while (i.hasNext()) {
      s += getNonTerminalDef(i.next()) + "\n";
    }

    return start + s.replace(start, "");
  }
コード例 #18
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 public boolean down() {
   for (Iterator<DarkChannel> i = chls.iterator(); i.hasNext(); ) {
     DarkChannel ch = i.next();
     if (ch.chan == sel) {
       if (i.hasNext()) {
         select(i.next().chan);
         return (true);
       } else {
         return (false);
       }
     }
   }
   return (false);
 }
コード例 #19
0
      public ProcessorState next() {
        if (!onProcInterator) {
          if (innerIter.hasNext()) return innerIter.next();
          else onProcInterator = true;
        }

        if (psi.processorIterator.hasNext()) {
          ProcessorState ps =
              new ProcessorState(
                  psi.processorIterator.next(), log, source, JavacProcessingEnvironment.this);
          psi.procStateList.add(ps);
          return ps;
        } else throw new NoSuchElementException();
      }
コード例 #20
0
ファイル: ZCM.java プロジェクト: ZeroCM/zcm
  /**
   * Remove this particular regex/subscriber pair (UNTESTED AND API MAY CHANGE). If regex is null,
   * all subscriptions for 'sub' are cancelled. If subscriber is null, any previous subscriptions
   * matching the regular expression will be cancelled. If both 'sub' and 'regex' are null, all
   * subscriptions will be cancelled.
   */
  public void unsubscribe(String regex, ZCMSubscriber sub) {
    if (this.closed) throw new IllegalStateException();

    synchronized (this) {
      for (Provider p : providers) p.unsubscribe(regex);
    }

    // TODO: providers don't seem to use anything beyond first channel

    synchronized (subscriptions) {

      // Find and remove subscriber from list
      for (Iterator<SubscriptionRecord> it = subscriptions.iterator(); it.hasNext(); ) {
        SubscriptionRecord sr = it.next();

        if ((sub == null || sr.lcsub == sub) && (regex == null || sr.regex.equals(regex))) {
          it.remove();
        }
      }

      // Find and remove subscriber from map
      for (String channel : subscriptionsMap.keySet()) {
        for (Iterator<SubscriptionRecord> it = subscriptionsMap.get(channel).iterator();
            it.hasNext(); ) {
          SubscriptionRecord sr = it.next();

          if ((sub == null || sr.lcsub == sub) && (regex == null || sr.regex.equals(regex))) {
            it.remove();
          }
        }
      }
    }
  }
コード例 #21
0
ファイル: PCNode.java プロジェクト: shahidminhas/abc
 public Set /*<PCNode>*/ matchSpecific(Pattern simple_name_pattern) {
   Set matches = new HashSet();
   Iterator ii = inners.keySet().iterator();
   while (ii.hasNext()) {
     String inner = (String) ii.next();
     // System.out.print("Matching "+inner+" against "+simple_name_pattern.pattern()+": ");
     if (simple_name_pattern.matcher(inner).matches()) {
       // System.out.println("true");
       matches.add(inners.get(inner));
     } else {
       // System.out.println("false");
     }
   }
   return matches;
 }
コード例 #22
0
  /** Method to dump debugging information */
  private void dumpAll(Map map, int lvmid) {
    if (DEBUG) {
      Set keys = map.keySet();

      System.err.println("Dump for " + lvmid);
      int j = 0;
      for (Iterator i = keys.iterator(); i.hasNext(); j++) {
        Monitor monitor = (Monitor) map.get(i.next());
        System.err.println(j + "\t" + monitor.getName() + "=" + monitor.getValue());
      }
      System.err.println("nextEntry = " + nextEntry + " pollForEntry = " + pollForEntry);
      System.err.println("Buffer info:");
      System.err.println("buffer = " + buffer);
    }
  }
コード例 #23
0
  private void printAnswersTokenizedInlineXML(List<IN> doc, PrintWriter out) {
    final String background = flags.backgroundSymbol;
    String prevTag = background;
    boolean first = true;
    for (Iterator<IN> wordIter = doc.iterator(); wordIter.hasNext(); ) {
      IN wi = wordIter.next();
      String tag = StringUtils.getNotNullString(wi.get(AnswerAnnotation.class));
      if (!tag.equals(prevTag)) {
        if (!prevTag.equals(background) && !tag.equals(background)) {
          out.print("</");
          out.print(prevTag);
          out.print("> <");
          out.print(tag);
          out.print('>');
        } else if (!prevTag.equals(background)) {
          out.print("</");
          out.print(prevTag);
          out.print("> ");
        } else if (!tag.equals(background)) {
          if (!first) {
            out.print(' ');
          }
          out.print('<');
          out.print(tag);
          out.print('>');
        }
      } else {
        if (!first) {
          out.print(' ');
        }
      }
      first = false;
      out.print(StringUtils.getNotNullString(wi.get(CoreAnnotations.OriginalTextAnnotation.class)));

      if (!wordIter.hasNext()) {
        if (!tag.equals(background)) {
          out.print("</");
          out.print(tag);
          out.print('>');
        }
        out.print(' ');
        prevTag = background;
      } else {
        prevTag = tag;
      }
    }
    out.println();
  }
コード例 #24
0
  private void printAnswersInlineXML(List<IN> doc, PrintWriter out) {
    final String background = flags.backgroundSymbol;
    String prevTag = background;
    for (Iterator<IN> wordIter = doc.iterator(); wordIter.hasNext(); ) {
      IN wi = wordIter.next();
      String tag = StringUtils.getNotNullString(wi.get(AnswerAnnotation.class));

      String before = StringUtils.getNotNullString(wi.get(BeforeAnnotation.class));

      String current =
          StringUtils.getNotNullString(wi.get(CoreAnnotations.OriginalTextAnnotation.class));
      if (!tag.equals(prevTag)) {
        if (!prevTag.equals(background) && !tag.equals(background)) {
          out.print("</");
          out.print(prevTag);
          out.print('>');
          out.print(before);
          out.print('<');
          out.print(tag);
          out.print('>');
        } else if (!prevTag.equals(background)) {
          out.print("</");
          out.print(prevTag);
          out.print('>');
          out.print(before);
        } else if (!tag.equals(background)) {
          out.print(before);
          out.print('<');
          out.print(tag);
          out.print('>');
        }
      } else {
        out.print(before);
      }
      out.print(current);
      String afterWS = StringUtils.getNotNullString(wi.get(AfterAnnotation.class));

      if (!tag.equals(background) && !wordIter.hasNext()) {
        out.print("</");
        out.print(tag);
        out.print('>');
        prevTag = background;
      } else {
        prevTag = tag;
      }
      out.print(afterWS);
    }
  }
コード例 #25
0
 public boolean hasNext() {
   try {
     return iterator.hasNext();
   } catch (Throwable t) {
     if ("ServiceConfigurationError".equals(t.getClass().getSimpleName())) {
       log.error("proc.bad.config.file", t.getLocalizedMessage());
     }
     throw new Abort(t);
   }
 }
コード例 #26
0
  protected void setupScoreBoardValues() {
    new ScoreBoardValue(
        "%sbto", "ScoreBoard Timeout Owner", getScoreBoard(), ScoreBoard.EVENT_TIMEOUT_OWNER) {
      public String getValue() {
        return getScoreBoard().getTimeoutOwner();
      }
    };
    new ScoreBoardValue(
        "%sbip", "ScoreBoard Is In Period", getScoreBoard(), ScoreBoard.EVENT_IN_PERIOD) {
      public String getValue() {
        return String.valueOf(getScoreBoard().isInPeriod());
      }
    };
    new ScoreBoardValue(
        "%sbio", "ScoreBoard Is In Overtime", getScoreBoard(), ScoreBoard.EVENT_IN_OVERTIME) {
      public String getValue() {
        return String.valueOf(getScoreBoard().isInOvertime());
      }
    };
    new ScoreBoardValue(
        "%sbos", "ScoreBoard Is Score Official", getScoreBoard(), ScoreBoard.EVENT_OFFICIAL_SCORE) {
      public String getValue() {
        return String.valueOf(getScoreBoard().isOfficialScore());
      }
    };

    setupTeamValues("1", Team.ID_1);
    setupTeamValues("2", Team.ID_2);
    setupClockValues("p", Clock.ID_PERIOD);
    setupClockValues("j", Clock.ID_JAM);
    setupClockValues("l", Clock.ID_LINEUP);
    setupClockValues("t", Clock.ID_TIMEOUT);
    setupClockValues("i", Clock.ID_INTERMISSION);

    StringBuffer patternBuffer = new StringBuffer();
    Iterator<String> patterns = scoreBoardValues.keySet().iterator();
    while (patterns.hasNext()) patternBuffer.append(patterns.next() + "|");
    String specifiersRegex = patternBuffer.toString().replaceAll("[|]$", "");
    formatPattern = Pattern.compile(specifiersRegex);
    eventPattern = Pattern.compile("^\\s*(" + specifiersRegex + ")");
    conditionPattern =
        Pattern.compile("(" + specifiersRegex + ")(?:(" + comparatorRegex + ")(\\S+))?");
  }
コード例 #27
0
  public List getProjectList() {
    List<Map> list = new ArrayList<Map>();

    try {

      String apiUrl = rallyApiHost + "/project?" + "fetch=true&order=Name&start=1&pagesize=200";

      log.info("rallyApiUrl:" + apiUrl);

      String responseXML = getRallyXML(apiUrl);

      org.jdom.input.SAXBuilder bSAX = new org.jdom.input.SAXBuilder();
      org.jdom.Document doc = bSAX.build(new StringReader(responseXML));
      Element root = doc.getRootElement();

      XPath xpath = XPath.newInstance("//Object");
      List xlist = xpath.selectNodes(root);

      Iterator iter = xlist.iterator();
      while (iter.hasNext()) {

        Map map = new HashMap();

        Element item = (Element) iter.next();
        String objId = item.getChildText("ObjectID");
        String name = item.getChildText("Name");
        String state = item.getChildText("State");

        map.put("objId", objId);
        map.put("name", name);
        map.put("state", state);

        list.add(map);
      }

    } catch (Exception ex) {
      log.error("ERROR: ", ex);
    }

    return list;
  }
コード例 #28
0
 public Processor next() {
   try {
     return (Processor) (iterator.next());
   } catch (Throwable t) {
     if ("ServiceConfigurationError".equals(t.getClass().getSimpleName())) {
       log.error("proc.bad.config.file", t.getLocalizedMessage());
     } else {
       log.error("proc.processor.constructor.error", t.getLocalizedMessage());
     }
     throw new Abort(t);
   }
 }
コード例 #29
0
ファイル: EBNF.java プロジェクト: meatlover/pai
  @Override
  protected EBNF clone() {

    /*
     *     protected Map<NonTerminal, List<? extends EBNFBranch>> nonTerminals;
     * protected NonTerminal startSymbol;
     */
    Map<NonTerminal, List<? extends EBNFBranch>> m =
        new HashMap<NonTerminal, List<? extends EBNFBranch>>();
    Iterator<NonTerminal> nts = nonTerminals.keySet().iterator();

    while (nts.hasNext()) {
      NonTerminal nt = nts.next().clone();

      // travel through all registered non terminals
      List<EBNFBranch> l = new ArrayList<EBNFBranch>();
      Iterator<? extends EBNFBranch> j = nonTerminals.get(nt).iterator();

      while (j.hasNext()) {
        l.add(j.next().clone());
      }

      m.put(nt, l);
    }

    return new EBNF(startSymbol.clone(), m);
  }
コード例 #30
0
  public JilterStatus eoh() {
    logger.debug("jilter eoh()");
    // includeBCC is false if RCPT TO does not contain at least one field in TO, FROM and CC
    // this is a safety check as sometimes, RCPT TO is something differently entirely
    // and does not contain the actual recipients in the email

    MilterServerService milterService = Config.getConfig().getMilterServerService();

    if (milterService.getIncludeBCC() && includeBCC) {
      logger.debug("including BCC addresses");
      // check to see if address is flagged to ignore
      if (rcpts.size() > 0) {
        Iterator<String> i = rcpts.iterator();
        while (i.hasNext()) {
          String rcpt = i.next();
          if (shouldIgnoreBCCAddress(rcpt)) {
            logger.debug("ignore include bcc address {address='" + rcpt + "'}");
            i.remove();
          }
        }
      }

      if (rcpts.size() > 0) {
        try {
          for (int j = 0; j < rcpts.size(); j++) {
            if (j == 0) {
              bos.write("bcc: ".getBytes());
            } else {
              bos.write(",".getBytes());
            }
            bos.write(rcpts.get(j).getBytes());
          }
          bos.write("\n".getBytes());
        } catch (IOException io) {
          logger.error("jilter failed to write end of header data", io);
        }
      }
    }
    return JilterStatus.SMFIS_CONTINUE;
  }