AnnotationTargetsImpl_Streamer.process(String, InputStream, boolean, boolean, boolean)
434933
@FFDCIgnore({ AnnotationTargetsVisitor.VisitEnded.class, ArrayIndexOutOfBoundsException.class })
    protected boolean scanClass(String classSourceName,
                                String className,
                                InputStream inputStream,
                                ScanPolicy scanPolicy) {

        Object[] logParms;
        if (tc.isDebugEnabled()) {
            logParms = new Object[] { getHashText(), className, null };
            Tr.debug(tc, MessageFormat.format("[ {0} ] ENTER class [ {1} ]", logParms));
        } else {
            logParms = null;
        }

        AnnotationTargetsVisitor useVisitor = getVisitor();

        useVisitor.i_setClassSourceName(internClassSourceName(classSourceName));

        // For non-seed scans, tell the visitor to only process the
        // class relationship information.  Skip class annotations and
        // and class contents (fields and methods).

        useVisitor.setScanPolicy(scanPolicy);
        useVisitor.setExternalName(className);

        boolean failedScan;

        try {
            // Both IOException and Exception have been seen;
            // in particular ArrayindexOutOfBoundsException for a non-valid class.

            ClassReader classReader = new ClassReader(inputStream); // throws IOException, Exception

            classReader.accept(getVisitor(),
                               (ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG | ClassReader.SKIP_CODE));
            // 'accept' throws IOException, VisitEnded, Exception

            failedScan = false;

            if (logParms != null) {
                logParms[2] = "Success";
            }

        } catch (IOException e) {
            failedScan = true;

            // String eMsg = "[ " + getHashText() + " ] Class [ " + className + " ] Exception creating reader";
            Tr.warning(tc, "ANNO_TARGETS_FAILED_TO_CREATE_READER", className); // CWWKC0049W

        } catch (AnnotationTargetsVisitor.VisitEnded e) {
            // 'VisitEnded' is used both for a normal flow control for
            // skipping detailed scan data (which is not a failed scan)
            // and for other cases, such as duplicate scan requests
            // and name mismatch cases, which are failures.

            failedScan = !e.isDetailCase();

            if (logParms != null) {
                logParms[2] = "Halted: " + e.getEndCase();
            }

        } catch (ArrayIndexOutOfBoundsException e) {
            Tr.info(tc, "ANNO_TARGETS_CORRUPT_CLASS", className, classSourceName);
            failedScan = true;

        } catch (Exception e) {
            // String eMsg = "[ " + getHashText() + " ] Visit failure [ " + className + " ]";
            // CWWKC0044W: An exception occurred while scanning class and annotation data.
            Tr.warning(tc, "ANNO_TARGETS_SCAN_EXCEPTION", e);

            if (logParms != null) {
                logParms[2] = "Exception: " + e.getMessage();
            }

            failedScan = true;
        }

        if (logParms != null) {
            Tr.debug(tc, MessageFormat.format("[ {0} ] RETURN From class [ {1} ]: [ {2} ]", logParms));
        }

        return (!failedScan);
    }
1169787
function processFile(filePath, callback) {
  /*jshint validthis:true */
  var processor = this;
  processor.emit('processing.start', {
    file: filePath
  });

  encoder.detectBom(filePath, function(err, bomName) {
    var status = 'good';

    if (err) {
      status = 'error';
      processor.emit('processing.error', {
        file: filePath,
        message: 'Skipping file with errors during encoding detection: ' + err
      });
      return callback(null, status);
    }
    else {
      var needsFixing = false;
      var lastByteSequenceWasCR = false;
      var bytesPerBom = encoder.getBytesPerBom(bomName);
      var bytesPerControlChar = encoder.getBytesPerControlChar(bomName);

      var transformBuffer = [];
      var tempBuffer = null;

      // Fast-forward past the BOM if present
      var onFirstReadable = function() {
        var bomBuffer = this.read(bytesPerBom);
        if (bomBuffer == null || bomBuffer.length !== bytesPerBom) {
          status = 'error';
          processor.emit('processing.error', {
            file: filePath,
            message: 'Skipping file with errors during read: Unable to read past the expected BOM'
          });
          return callback(null, status);
        }
      };
      var onReadable = function() {
        var data = this.read(),
            i = 0,
            len = data.length,
            cursor = i,
            buffer;
        for ( ; i < len; i += bytesPerControlChar) {
          buffer = slicer.call(data, i, i + bytesPerControlChar);

          // If we read less bytes than the minimum number necessary to register
          // as a complete character in this encoding, put them back on the front
          // of the read queue for the next read and then bail out.
          if (buffer.length < bytesPerControlChar) {
            if (!tempBuffer || !arraysMatch(buffer, tempBuffer)) {
              tempBuffer = buffer;
              // Save these rogue bytes to inspect on the next time around
              this.unshift(data.slice(i, i + buffer.length));
              // Break out of the loop
              break;
            }
            else {
              // This will prevent an infinite loop if the number of bytes in the file
              // is erroneous/irregular, e.g. a total of 7 bytes in a UTF-16 file.
              status = 'error';

              // Send a signal to cause early termination (i.e. trigger the 'end' event)
              this.push(null);
              // Break out of the loop
              break;
            }
          }
          tempBuffer = null;

          if (encoder.doesByteSequenceSuggestBinary(buffer, bomName)) {
            status = 'skip';
            processor.emit('processing.skip', {
              file: filePath,
              message: 'Skipping suspected binary file'
            });
            // Send a signal to cause early termination (i.e. trigger the 'end' event)
            this.push(null);
            // Break out of the loop
            break;
          }
          else {
            if (encoder.isByteSequenceCR(buffer, bomName)) {
              lastByteSequenceWasCR = true;
            }
            else {
              if (lastByteSequenceWasCR && encoder.isByteSequenceLF(buffer, bomName)) {
                needsFixing = true;

                // Push everything (except for CRs) into the outgoing buffer
                transformBuffer.splice.apply(transformBuffer, [transformBuffer.length, 0].concat(slicer.call(data, cursor, i - bytesPerControlChar)));
                cursor = i;
              }

              // If this is the last byte of the buffer, push the remaining data into the outgoing buffer
              if (i + bytesPerControlChar === len && needsFixing) {
                // Push everything (except for CRs) into the outgoing buffer
                transformBuffer.splice.apply(transformBuffer, [transformBuffer.length, 0].concat(slicer.call(data, cursor)));
              }

              // Reset
              lastByteSequenceWasCR = false;
            }
          }
        }
      };
      var onError = function(err) {
        status = 'error';
        processor.emit('processing.error', {
          file: filePath,
          message: 'Skipping file with errors during read: ' + err
        });
        return callback(null, status);
      };
      var onEnd = function() {
        if (status === 'good') {
          if (needsFixing) {
            status = 'bad';
            this.on('close', function() {
              // Overwrite the existing file with the fixed data
              process.nextTick(function() {
                processor.emit('convert.start', {
                  file: filePath
                });

                //
                // TODO: Is there a more optimal way to do this?
                //       e.g. TransformStream, write to temp then move, etc.
                //
                fs.writeFile(filePath, new Buffer(transformBuffer), function(err) {
                  if (err) {
                    status = 'error';
                    processor.emit('convert.error', {
                      file: filePath,
                      message: 'Unexpected error during conversion process: ' + err
                    });
                  }
                  else {
                    status = 'fix';
                    processor.emit('convert.end', {
                      file: filePath
                    });
                  }

                  processor.emit('processing.end', {
                    file: filePath
                  });
                  return callback(null, status);
                });
              });
            });
          }
          else {
            status = 'skip';
            processor.emit('processing.skip', {
              file: filePath,
              message: 'Skipping file with all correct line endings'
            });
          }
        }

        if (status === 'skip') {
          processor.emit('processing.end', {
            file: filePath
          });
        }
        if (status !== 'bad') {
          return callback(null, status);
        }
      };

      var reader = new Readable();
      reader.wrap(fs.createReadStream(filePath));

      if (bytesPerBom > 0) {
        reader.once('readable', onFirstReadable);
      }
      reader
        .on('readable', onReadable)
        .on('error', onError)
        .on('end', onEnd);
    }
  });
}
450145
protected /*HttpBuilder*/void streamOut(InputStream in) {
//        StreamResponse resp = new StreamResponse(context, in);
//        context.setControllerResponse(resp);
//        return new HttpBuilder(resp);
        //TODO finish and TEST the god damn method
        //------------------
        Result r = ResultBuilder.ok()
                .contentType(MediaType.APPLICATION_OCTET_STREAM)
                .renderable(in);
//        context.setControllerResponse(r);
        result = r;
    }
149419
public boolean compileFromPMML(final InputStream stream) {
        pmmlDocument = compiler.loadModel(PMML.class.getPackage().getName(), stream);
        return pmmlDocument != null;
    }
163811
@Override
    protected void processClass (File source, Class<?> sclass)
        throws IOException
    {
        StreamableClassRequirements reqs = new StreamableClassRequirements(sclass);
        // we must implement Streamable, not be a DObject and have some fields that need to be
        // streamed
        if (!Streamable.class.isAssignableFrom(sclass) || DObject.class.isAssignableFrom(sclass) ||
                reqs.streamedFields.isEmpty()) {
            // System.err.println("Skipping " + sclass.getName() + "...");
            return;
        }

        // add readObject() and writeObject() definitions
        StringBuilder readbuf = new StringBuilder(READ_OPEN);
        StringBuilder writebuf = new StringBuilder(WRITE_OPEN);

        if (reqs.superclassStreamable) {
            readbuf.append("        super.readObject(ins);\n");
            writebuf.append("        super.writeObject(out);\n");
        }
        for (Field field : reqs.streamedFields) {
            readbuf.append("        ");
            readbuf.append(field.getName()).append(" = ");
            readbuf.append(toReadObject(field));
            readbuf.append(";\n");

            writebuf.append("        out.");
            writebuf.append(toWriteObject(field));
            writebuf.append(";\n");
        }

        readbuf.append(READ_CLOSE);
        writebuf.append(WRITE_CLOSE);

        SourceFile sfile = new SourceFile();
        try {
            sfile.readFrom(source);
        } catch (IOException ioe) {
            System.err.println("Error reading " + source + ": " + ioe);
        }

        // don't overwrite an existing readObject() or writeObject()
        StringBuilder methods = new StringBuilder();
        if (!sfile.containsString("public void readObject")) {
            methods.append(readbuf);
        }
        if (!sfile.containsString("public void writeObject")) {
            if (methods.length() > 0) {
                methods.append("\n");
            }
            methods.append(writebuf);
        }
        if (methods.length() == 0) {
            return; // nothing to do
        }

        System.err.println("Converting " + sclass.getName() + "...");

        writeFile(source.getAbsolutePath(), sfile.generate(null, methods.toString()));
    }
1239149
@Task(name = "createStream", version = "1.0", resource = "{scope}/{stream}")
    public CompletableFuture<CreateStreamStatus.Status> createStream(String scope, String stream, StreamConfiguration config, long createTimestamp) {
        return execute(
                new Resource(scope, stream),
                new Serializable[]{scope, stream, config, createTimestamp},
                () -> createStreamBody(scope, stream, config, createTimestamp));
    }
1229273
function(options) {
			this.inputStream = options.inputStream || process.stdin;
			this.outputStream = options.outputStream || process.stdout;
		}
323590
@Override
    public <E> DynamicType.Builder<E> processMethod(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation)
    {
        String methodName = method.getName();
        if (ReflectionUtility.isGetMethod(method))
            return createInterceptor(builder, method);
        else if (ReflectionUtility.isSetMethod(method))
            return createInterceptor(builder, method);
        else if (methodName.startsWith("addAll"))
            return createInterceptor(builder, method);
        else if (methodName.startsWith("add"))
            return createInterceptor(builder, method);
        else
            throw new WindupException("Only get*, set*, add*, and addAll* method names are supported for @"
                        + SetInProperties.class.getSimpleName() + ", found at: " + method.getName());
    }
948749
public static void processSentences(
			CMMClassifier<CoreLabel> cmm, PrintStream out, String text) {
		
		if (inputType == inputTypes.PARAGRAPH) { // split in multiple sentences
			if (outputSeparators) out.println("<p>");
			LinkedList<LinkedList<Word>> sentences = Splitting.tokenizeSentences(LVMorphologyReaderAndWriter.getAnalyzer(), text, sentencelengthcap);
			for (LinkedList<Word> sentence : sentences) 
				outputSentence(cmm, out, LVMorphologyReaderAndWriter.analyzeSentence2(sentence) );
			if (outputSeparators) 
				out.println("</p>");
			else 
				out.println();
		} else outputSentence(cmm, out, LVMorphologyReaderAndWriter.analyzeSentence(text) ); // just a single sentence for other types
	}

	/**
	 * Outputs the tagged sentence according to the outputType set in this class
	 * @param cmm - the tagger, needed to retrieve tagger features if they are requested
	 * @param out - a stream to output the data
	 * @param sentence - actual tokens to be output
	 */
	public static void outputSentence(CMMClassifier<CoreLabel> cmm,
			PrintStream out, List<CoreLabel> sentence) {
		if (outputSeparators) out.println("<s>");

        if (outputType != outputTypes.lowercasedText && outputType != outputTypes.analyzerOptions) { //FIXME - a separate flag would be better
            sentence = cmm.classify(sentence); // runs the actual morphotagging system
        }

		switch (outputType) {
		case JSON:
			out.println( output_JSON(sentence));
			break;
		case CONLL_X:
			out.println( output_CONLL(sentence, cmm));
			break;
		case XML:
			try {
				output_XML(sentence, out);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			break;
		case VISL_CG:
			out.println( output_VISL(sentence));
			break;
		case lemmatizedText:
			out.println( output_lemmatized(sentence));
			break;
        case lowercasedText:
            out.println( output_lowercased(sentence));
            break;
        case analyzerOptions:
            out.println( output_analyzer(sentence));
            break;
		default:
			out.println( output_separated(sentence));	    
		}
		if (outputSeparators) out.println("</s>");
		out.flush();
	}	
	
	private static String output_JSON(List<CoreLabel> tokens) {		
		LinkedList<String> tokenJSON = new LinkedList<String>();
		
		for (CoreLabel word : tokens) {
			String token = word.getString(TextAnnotation.class);
			if (token.contains("<s>")) continue;
			Word analysis = word.get(LVMorphologyAnalysis.class);
			Wordform maxwf = analysis.getMatchingWordform(word.getString(AnswerAnnotation.class), false);
			if (mini_tag) maxwf.removeNonlexicalAttributes();
			if (maxwf != null)
				tokenJSON.add(String.format("{\"Word\":\"%s\",\"Tag\":\"%s\",\"Lemma\":\"%s\"}", JSONValue.escape(token), JSONValue.escape(maxwf.getTag()), JSONValue.escape(maxwf.getValue(AttributeNames.i_Lemma))));
			else 
				tokenJSON.add(String.format("{\"Word\":\"%s\",\"Tag\":\"-\",\"Lemma\":\"%s\"}", JSONValue.escape(token), JSONValue.escape(token)));			
		}
		
		String s = formatJSON(tokenJSON).toString();

		return s;
	}
	
	private static void output_XML(List<CoreLabel> tokens, PrintStream straume) throws IOException {
		PrintWriter w = new PrintWriter(straume);
		for (CoreLabel word : tokens) {
			String token = word.getString(TextAnnotation.class);
			if (token.contains("<s>")) continue;
			Word analysis = word.get(LVMorphologyAnalysis.class);
			Wordform maxwf = analysis.getMatchingWordform(word.getString(AnswerAnnotation.class), false);
			if (mini_tag) maxwf.removeNonlexicalAttributes();
			maxwf.addAttribute("Tag", maxwf.getTag());
			maxwf.toXML(w);
//			if (maxwf != null)
//				tokenJSON.add(String.format("{\"Word\":\"%s\",\"Tag\":\"%s\",\"Lemma\":\"%s\"}", JSONValue.escape(token), JSONValue.escape(maxwf.getTag()), JSONValue.escape(maxwf.getValue(AttributeNames.i_Lemma))));
//			else 
//				tokenJSON.add(String.format("{\"Word\":\"%s\",\"Tag\":\"-\",\"Lemma\":\"%s\"}", JSONValue.escape(token), JSONValue.escape(token)));			
		}		
		w.flush();
	}

	private static String output_CONLL(List<CoreLabel> tokens, CMMClassifier<CoreLabel> cmm){
		StringBuilder s = new StringBuilder();

		int counter = 1;
		for (CoreLabel word : tokens) {
			String token = word.getString(TextAnnotation.class);
			if (token.contains("<s>")) continue;
			token = token.replace(' ', '_');
			
			s.append(Integer.toString(counter));
			s.append('\t');
			s.append(token);
			s.append('\t');
			Word analysis = word.get(LVMorphologyAnalysis.class);
			Wordform mainwf = analysis.getMatchingWordform(word.getString(AnswerAnnotation.class), false); 
			if (mainwf != null) {
				String lemma = mainwf.getValue(AttributeNames.i_Lemma);
				lemma = lemma.replace(' ', '_');
				String answer = word.getString(AnswerAnnotation.class);
				if (answer.trim().isEmpty()) answer = "_"; // no empty tag
				s.append(lemma);
				s.append('\t');
				s.append(answer);
				s.append('\t');
				s.append(mainwf.getTag());
				s.append('\t');

				// Feature atribūtu filtri
				if (mini_tag) mainwf.removeNonlexicalAttributes();
				if (LETAfeatures) {
					addLETAfeatures(mainwf);
					// mainwf.removeAttribute(AttributeNames.i_SourceLemma); FIXME - atvasinātiem vārdiem šis var būt svarīgs, atpriedekļotas lemmas..
					mainwf.removeTechnicalAttributes();
				}
				
				s.append(mainwf.pipeDelimitedEntries()); // Pievienojam vārda fīčas
				
				if (features) { // visas fīčas, ko lietoja trenējot
					Datum<String, String> d = cmm.makeDatum(tokens, counter, cmm.featureFactory);
					for (String feature : d.asFeatures()) {
						s.append(feature.substring(0, feature.length()-2).replace(' ', '_')); // noņeam trailing |C kas tām fīčām tur ir
						s.append('|');
					}
				}
				s.deleteCharAt(s.length()-1); // noņemam peedeejo | separatoru, kas ir lieks
				s.append('\t');
				
			} else {
				s.append(token); 
				s.append("\t_\t_\t_\t");
			}
			if (saveColumns) {
				s.append(word.getString(ExtraColumnAnnotation.class));
			} else {
				String syntax = word.getString(ParentAnnotation.class);
				if (syntax != null) {
					s.append(syntax);
				}
				else s.append("_\t_\t_\t_");
			}
			s.append(eol);
			counter++;
		}
		
		return s.toString();
	}
	
	private static String output_lemmatized(List<CoreLabel> tokens){
		StringBuilder s = new StringBuilder();
		
		for (CoreLabel word : tokens) {
			String token = word.getString(TextAnnotation.class);
			if (token.contains("<s>")) continue;
			token = token.replace(' ', '_');
			
			Word analysis = word.get(LVMorphologyAnalysis.class);
			Wordform mainwf = analysis.getMatchingWordform(word.getString(AnswerAnnotation.class), false); 
			if (mainwf != null && !token.isEmpty()) {
				String lemma = mainwf.getValue(AttributeNames.i_Lemma);
				if (saveCase && Character.isUpperCase(token.charAt(0))) lemma = lemma.substring(0,1).toUpperCase() + lemma.substring(1);
				if (!saveCase) lemma=lemma.toLowerCase();
				lemma = lemma.replace(' ', '_');
				s.append(lemma);
				s.append(' ');
				
			} else {
				System.err.println("Empty lemma");
			}
		}
		return s.toString().trim();
	}

    private static String output_lowercased(List<CoreLabel> tokens){
        StringBuilder s = new StringBuilder();

        for (CoreLabel word : tokens) {
            String token = word.getString(TextAnnotation.class);
            if (token.contains("<s>")) continue;
            token = token.replace(' ', '_').toLowerCase();
            s.append(token);
            s.append(' ');
        }
        return s.toString().trim();
    }

    private static String output_analyzer(List<CoreLabel> tokens){
        StringBuilder s = new StringBuilder();

        for (CoreLabel word : tokens) {
            String token = word.getString(TextAnnotation.class);
            if (token.contains("<s>")) continue;
            token = token.replace(' ', '_');
            s.append(token);
            Word analysis = word.get(LVMorphologyAnalysis.class);
            for (Wordform wf : analysis.wordforms) {
                s.append(token_separator);
                s.append(wf.getTag());
            }
        }
        return s.toString().trim();
    }

	private static void addLETAfeatures(Wordform wf) {
		String lemma = wf.getValue(AttributeNames.i_Lemma);
				
		if (wf.isMatchingStrong(AttributeNames.i_PartOfSpeech, AttributeNames.i_Number)) {
			String numbercode = lemma.replaceAll("\\d", "0"); // uzskatam ka nav atšķirības starp skaitļiem ja ciparu skaits vienāds
			wf.addAttribute("LETA_lemma", numbercode);
		} else if (wf.isMatchingStrong(AttributeNames.i_CapitalLetters, AttributeNames.v_FirstUpper) && Dictionary.dict("surnames").contains(lemma))
			wf.addAttribute("LETA_lemma", "_surname_");
		else if (Dictionary.dict("vocations").contains(lemma))
			wf.addAttribute("LETA_lemma", "_vocation_");
		else if (Dictionary.dict("relations").contains(lemma))
			wf.addAttribute("LETA_lemma", "_relationship_");
		else if (Dictionary.dict("partijas").contains(lemma))
			wf.addAttribute("LETA_lemma", "_party_"); // TODO - nočekot kā visā procesā sanāk ar case-sensitivity, te tas ir svarīgi
		else if (Dictionary.dict("months").contains(lemma)) // TODO - te būtu jāčeko, lai personvārdi Marts un Jūlijs te neapēdas, ja ir ar lielo burtu ne teikuma sākumā 
			wf.addAttribute("LETA_lemma", "_month_"); 
		else if (Dictionary.dict("common_lemmas").contains(lemma)) 
			wf.addAttribute("LETA_lemma", lemma);
		else wf.addAttribute("LETA_lemma", "_rare_");		
	}

	// VISL CG format, as described in http://beta.visl.sdu.dk/cg3/chunked/streamformats.html#stream-vislcg
	private static String output_VISL(List<CoreLabel> tokens) {		
		StringBuilder s = new StringBuilder();
		
		for (CoreLabel word : tokens) {
			String token = word.getString(TextAnnotation.class);
			if (token.contains("<s>")) continue;
			
			token.replaceAll("\"", "\\\""); // VISL (seems to) require to escape quotes in their format. Possibly other escaping needs, not sure from their docs.
			
			s.append(String.format("\"<%s>\"\n", token)); // <"They"> from the example
			
			Word analysis = word.get(LVMorphologyAnalysis.class);
			Wordform maxwf = analysis.getMatchingWordform(word.getString(AnswerAnnotation.class), false);
			for (Wordform wf : analysis.wordforms) { // output the "cohort" in VISL-CG terms
				String lemma = wf.getValue(AttributeNames.i_Lemma);
				//Ad-hoc ... removing 'bookkeeping' attributes that seem useless for CG
				wf.removeTechnicalAttributes();
				wf.removeAttribute(AttributeNames.i_Lemma);
				wf.removeAttribute(AttributeNames.i_SourceLemma);
				
				lemma.replaceAll("\"", "\\\"");
				s.append(String.format("\t\"%s\" ", lemma)); // <"They"> from the example
				s.append(wf.getTag());
				s.append(" ");
				AttributeValues minimum = new AttributeValues(wf);
				minimum.removeNonlexicalAttributes();
				s.append(minimum.getTag());
				s.append(" ");
				for (Entry<String, String> entry : wf.entrySet()) { // visi attributevalue paariishi
					String key = entry.getKey();
					String value = entry.getValue();
					// For attributes with distinctive value names (like parts of speech) skip the attribute name for readability in CG
					if ((!key.equalsIgnoreCase(AttributeNames.i_PartOfSpeech) && 
						!key.equalsIgnoreCase(AttributeNames.i_Case) && 
						!key.equalsIgnoreCase(AttributeNames.i_Number) &&
						!key.equalsIgnoreCase(AttributeNames.i_Gender) &&
						!key.equalsIgnoreCase(AttributeNames.i_NounType) &&
						!key.equalsIgnoreCase(AttributeNames.i_Izteiksme) &&
						!key.equalsIgnoreCase(AttributeNames.i_VerbType) &&
						!key.equalsIgnoreCase(AttributeNames.i_Laiks) &&
						!key.equalsIgnoreCase(AttributeNames.i_Transitivity) &&
						!key.equalsIgnoreCase(AttributeNames.i_Declension) &&						
						!key.equalsIgnoreCase(AttributeNames.i_Definiteness) &&
						!key.equalsIgnoreCase(AttributeNames.i_Lokaamiiba) &&
						!key.equalsIgnoreCase(AttributeNames.i_AdjectiveType) &&
						!key.equalsIgnoreCase(AttributeNames.i_SaikljaTips) &&
						!key.equalsIgnoreCase(AttributeNames.i_Uzbuuve) &&
						!key.equalsIgnoreCase(AttributeNames.i_PieturziimesTips) &&
						!key.equalsIgnoreCase(AttributeNames.i_Voice) &&
						!key.equalsIgnoreCase(AttributeNames.i_VvTips)
						) || (value.equalsIgnoreCase(AttributeNames.v_NA) &&
								!key.equalsIgnoreCase(AttributeNames.i_Anafora) &&
								!key.equalsIgnoreCase(AttributeNames.i_Laiks)
						)) {
						 s.append(key.replace(' ', '_')); 
						 s.append('=');
					}
					 s.append(value.replace(' ', '_'));
					 s.append(' ');
				}
				s.append(eol);
			}
		}
		
		s.append("\"<<s>>\"");
		
		return s.toString();
	}
	
	private static String output_separated(List<CoreLabel> tokens){
		StringBuilder s = new StringBuilder();
		
		for (CoreLabel word : tokens) {
			String token = word.getString(TextAnnotation.class);
			if (token.contains("<s>")) continue;
            Word analysis = word.get(LVMorphologyAnalysis.class);
            Wordform mainwf = analysis.getMatchingWordform(word.getString(AnswerAnnotation.class), false);

            if (s.length()>0) s.append(token_separator);
            if (whitespaceMarker && mainwf.isMatchingStrong(AttributeNames.i_WhitespaceBefore, "")) {
                s.append("<g />");
                s.append(token_separator);
            }

            if (outputType == outputTypes.MOSES) token = token.replace(' ', '_');
			s.append(token);
			s.append(field_separator);

			if (mainwf != null) {
				if (mini_tag) mainwf.removeNonlexicalAttributes();
				s.append(mainwf.getTag());
				s.append(field_separator);
				String lemma = mainwf.getValue(AttributeNames.i_Lemma);
				if (outputType == outputTypes.MOSES) lemma = lemma.replace(' ', '_');
				s.append(lemma);
			} else s.append(field_separator); 
			/*
			mainwf = word.get(LVMorphologyAnalysisBest.class);
			if (mainwf != null) {
				s.append("Single-token suggestion:\t");
				s.append(mainwf.getTag());
				s.append("\t");
				s.append(mainwf.getValue(AttributeNames.i_Lemma));
				s.append("\t");
			}
			s.append("\n");
			if (all_options)
					s.append(word.toTabSep(statistics, probabilities));
			else s.append(word.toTabSepsingle(statistics)); */
		}
		
		tokens = null;
		return s.toString();
	}
	
	private static StringBuilder formatJSON(Collection<String> tags) {
		Iterator<String> i = tags.iterator();
		StringBuilder out = new StringBuilder("[");
		while (i.hasNext()) {
			out.append(i.next());
			if (i.hasNext()) out.append(", ");
		}
		out.append("]");
		return out;
	}
	
	
	public static List<List<CoreLabel>> readCONLL(BufferedReader in) throws IOException {
		String s;
	    List<CoreLabel> sentence = new LinkedList<CoreLabel>();
	    List<List<CoreLabel>> result = new LinkedList<List<CoreLabel>>();
	    
	    CoreLabel stag = new CoreLabel();
		stag.set(TextAnnotation.class, "<s>");
		sentence.add(stag);
	    
	    while ((s = in.readLine()) != null) {
	    	if (s.trim().length() > 0) {
	    		String[] fields = s.split("\t");
	    		String token = fields[1];
	    		if (!token.equalsIgnoreCase("_")) token = token.replace('_', ' ');
	    		String extraColumns = "";
	    		if (saveColumns) {
	    			for (int field_i = 6; field_i < fields.length; field_i++) extraColumns += fields[field_i] + "\t";
	    			extraColumns.trim();
	    		}	    		
	    		String syntax = "";
	    		if (fields.length >= 10) syntax = fields[6] + "\t" + fields[7] + "\t" + fields[8] + "\t" + fields[9];

	    		CoreLabel word = new CoreLabel();
				word.set(TextAnnotation.class, token);
				word.set(ParentAnnotation.class, syntax);
				word.set(ExtraColumnAnnotation.class, extraColumns);
	    		sentence.add(word);
	    	} else {
	    		stag = new CoreLabel();
	    		stag.set(TextAnnotation.class, "<s>");
	    		sentence.add(stag);
	    		
	    		result.add(LVMorphologyReaderAndWriter.analyzeLabels(sentence));
	    		
	    		sentence = new LinkedList<CoreLabel>();
	    		stag = new CoreLabel();
	    		stag.set(TextAnnotation.class, "<s>");
	    		sentence.add(stag);
	    	}
	    }
	    if (sentence.size() > 0) {
	    	stag = new CoreLabel();
			stag.set(TextAnnotation.class, "<s>");
			sentence.add(stag);
	    	result.add(LVMorphologyReaderAndWriter.analyzeLabels(sentence));
	    }
	    		
		return result;
	}

}
1057609
public void processAnnotations(List<JCCompilationUnit> roots,
                                   Collection<String> classnames) {
        if (shouldStop(CompileState.PROCESS)) {
            // Errors were encountered.
            // Unless all the errors are resolve errors, the errors were parse errors
            // or other errors during enter which cannot be fixed by running
            // any annotation processors.
            if (unrecoverableError()) {
                deferredDiagnosticHandler.reportDeferredDiagnostics();
                log.popDiagnosticHandler(deferredDiagnosticHandler);
                return ;
            }
        }

        // ASSERT: processAnnotations and procEnvImpl should have been set up by
        // by initProcessAnnotations

        // NOTE: The !classnames.isEmpty() checks should be refactored to Main.

        if (!processAnnotations) {
            // If there are no annotation processors present, and
            // annotation processing is to occur with compilation,
            // emit a warning.
            if (options.isSet(PROC, "only")) {
                log.warning("proc.proc-only.requested.no.procs");
                todo.clear();
            }
            // If not processing annotations, classnames must be empty
            if (!classnames.isEmpty()) {
                log.error("proc.no.explicit.annotation.processing.requested",
                          classnames);
            }
            Assert.checkNull(deferredDiagnosticHandler);
            return ; // continue regular compilation
        }

        Assert.checkNonNull(deferredDiagnosticHandler);

        try {
            List<ClassSymbol> classSymbols = List.nil();
            List<PackageSymbol> pckSymbols = List.nil();
            if (!classnames.isEmpty()) {
                 // Check for explicit request for annotation
                 // processing
                if (!explicitAnnotationProcessingRequested()) {
                    log.error("proc.no.explicit.annotation.processing.requested",
                              classnames);
                    deferredDiagnosticHandler.reportDeferredDiagnostics();
                    log.popDiagnosticHandler(deferredDiagnosticHandler);
                    return ; // TODO: Will this halt compilation?
                } else {
                    boolean errors = false;
                    for (String nameStr : classnames) {
                        Symbol sym = resolveBinaryNameOrIdent(nameStr);
                        if (sym == null ||
                            (sym.kind == PCK && !processPcks) ||
                            sym.kind == ABSENT_TYP) {
                            if (sym != silentFail)
                                log.error(Errors.ProcCantFindClass(nameStr));
                            errors = true;
                            continue;
                        }
                        try {
                            if (sym.kind == PCK)
                                sym.complete();
                            if (sym.exists()) {
                                if (sym.kind == PCK)
                                    pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                                else
                                    classSymbols = classSymbols.prepend((ClassSymbol)sym);
                                continue;
                            }
                            Assert.check(sym.kind == PCK);
                            log.warning(Warnings.ProcPackageDoesNotExist(nameStr));
                            pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                        } catch (CompletionFailure e) {
                            log.error(Errors.ProcCantFindClass(nameStr));
                            errors = true;
                            continue;
                        }
                    }
                    if (errors) {
                        deferredDiagnosticHandler.reportDeferredDiagnostics();
                        log.popDiagnosticHandler(deferredDiagnosticHandler);
                        return ;
                    }
                }
            }
            try {
                annotationProcessingOccurred =
                        procEnvImpl.doProcessing(roots,
                                                 classSymbols,
                                                 pckSymbols,
                                                 deferredDiagnosticHandler);
                // doProcessing will have handled deferred diagnostics
            } finally {
                procEnvImpl.close();
            }
        } catch (CompletionFailure ex) {
            log.error("cant.access", ex.sym, ex.getDetailValue());
            if (deferredDiagnosticHandler != null) {
                deferredDiagnosticHandler.reportDeferredDiagnostics();
                log.popDiagnosticHandler(deferredDiagnosticHandler);
            }
        }
    }
846889
private Runnable createProcessRunner(final BlockingQueue<FlowletProcessEntry<?>> processQueue,
                                       final List<FlowletProcessEntry<?>> processList,
                                       final ClassLoader classLoader) {
    return new Runnable() {
      @Override
      public void run() {
        Thread.currentThread().setContextClassLoader(classLoader);
        for (FlowletProcessEntry<?> entry : processList) {
          if (!handleProcessEntry(entry, processQueue)) {
            processQueue.offer(entry);
          }
        }
      }
    };
  }
875089
public void process(InputStream input) throws IOException, ConverterException {
        while (0 != input.available()) {
            Tag tag = ParserUtils.parseTag(input);
            TagHandler handler = getHandler(tag);
            if (null == handler) {
                skipHandler.handle(tag, input);
            } else {
                handler.handle(tag, input);
            }
        }
    }
1147464
@SuppressWarnings("unchecked")
    private void processToString(ClassTraceInfo info) {
        for (MethodNode mn : (List<MethodNode>) info.classNode.methods) {
            if (!mn.name.equals("toString") || !mn.desc.equals("()Ljava/lang/String;")) {
                continue;
            }
            Iterator<? extends AbstractInsnNode> instructionIterator = mn.instructions.iterator();
            INSN_LOOP: while (instructionIterator.hasNext()) {
                AbstractInsnNode insnNode = instructionIterator.next();
                if (insnNode.getType() == AbstractInsnNode.METHOD_INSN) {
                    MethodInsnNode methodInsn = (MethodInsnNode) insnNode;

                    // Skip static methods
                    if (methodInsn.getOpcode() == Opcodes.INVOKESTATIC) {
                        continue;
                    }

                    // Skip methods that aren't part of this class
                    if (!methodInsn.owner.equals(info.classNode.name)) {
                        continue;
                    }

                    // Skip explicitly trivial methods from this file class
                    MethodNode m = getMethod(methodInsn.name, methodInsn.desc, info.classNode.methods);
                    if (m != null && getAnnotation(TRIVIAL_TYPE.getDescriptor(), m.visibleAnnotations) != null) {
                        continue;
                    }

                    // If the target method is not found on this class and the super class
                    // is in the set of files being instrumented, see if it's trivial
                    String superName = info.classNode.superName;
                    while (m == null && superName != null && !"java/lang/Object".equals(superName)) {
                        if (superName.startsWith("java/") || superName.startsWith("javax/")) {
                            continue INSN_LOOP;
                        }
                        InputStream superClassInputStream = getClassInputStream(superName);
                        if (superClassInputStream == null) {
                            StringBuilder sb = new StringBuilder();
                            sb.append("INFO: ").append(info.classNode.name.replaceAll("/", "\\."));
                            sb.append(" extends class ").append(superName.replaceAll("/", "\\."));
                            sb.append(" and is calling ").append(methodInsn.name);
                            sb.append(" from toString()");
                            info.warnings.add(sb.toString());
                            continue INSN_LOOP;
                        }
                        ClassNode cn = getClassNode(superClassInputStream, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG);
                        m = getMethod(methodInsn.name, methodInsn.desc, cn.methods);
                        superName = cn.superName;
                    }

                    // Found a method declaration on the super class that's marked as trivial
                    if (m != null && getAnnotation(TRIVIAL_TYPE.getDescriptor(), m.visibleAnnotations) != null) {
                        continue;
                    }

                    // Add a warning
                    StringBuilder sb = new StringBuilder();
                    sb.append("WARNING: ").append(info.classNode.name.replaceAll("/", "\\."));
                    sb.append(" is calling traceable methods from toString(); this may result in infinite recursion.  ");
                    sb.append("Consider referencing class fields or marking the called methods trivial to avoid trace.");
                    info.warnings.add(sb.toString());
                    break;
                }
            }
        }
    }
869684
private void processWatchers(MethodSpec.Builder createdMethodBuilder) {
    createdMethodBuilder.addStatement("Proto p = __proto__");
    getMethodsWithAnnotation(component, Watch.class)
        .forEach(method -> processWatcher(createdMethodBuilder, method));
  }
1030301
public <T extends Application> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event) {

        AnnotatedType<T> annotatedType = event.getAnnotatedType();
        if (Application.class.isAssignableFrom(annotatedType.getJavaClass())) {
            // Do our magic.
            event.setAnnotatedType(new AnnotatedType<T>() {
                private final Annotation ADD_SWAGGER_ANNOTATION = () -> AddSwaggerResources.class;

                @Override
                public Class<T> getJavaClass() {
                    return annotatedType.getJavaClass();
                }

                @Override
                public Set<AnnotatedConstructor<T>> getConstructors() {
                    return annotatedType.getConstructors();
                }

                @Override
                public Set<AnnotatedMethod<? super T>> getMethods() {
                    return annotatedType.getMethods();
                }

                @Override
                public Set<AnnotatedField<? super T>> getFields() {
                    return annotatedType.getFields();
                }

                @Override
                public Type getBaseType() {
                    return annotatedType.getBaseType();
                }

                @Override
                public Set<Type> getTypeClosure() {
                    return annotatedType.getTypeClosure();
                }

                @SuppressWarnings("unchecked")
                @Override
                public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
                    if (AddSwaggerResources.class.equals(annotationType)) {
                        return (A) ADD_SWAGGER_ANNOTATION;
                    }
                    return annotatedType.getAnnotation(annotationType);
                }

                @Override
                public Set<Annotation> getAnnotations() {
                    Set<Annotation> annotations = new HashSet<>(annotatedType.getAnnotations());
                    annotations.add(ADD_SWAGGER_ANNOTATION);
                    return annotations;
                }

                @Override
                public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
                    return false;
                }
            });
        }
    }
706567
public OutputStream process(InputStream inputStream, DrawTextParameter drawParam, int maxWidth, int maxHeight)
                                                                                                                  throws SimpleImageException {
        ImageRender wr = null;
        ByteArrayOutputStream output = null;

        try {
            inputStream = ImageUtils.createMemoryStream(inputStream);
            output = new ByteArrayOutputStream();
            ImageFormat outputFormat = ImageUtils.isGIF(inputStream) ? ImageFormat.GIF : ImageFormat.JPEG;
            ScaleParameter scaleParam = new ScaleParameter(maxWidth, maxHeight, Algorithm.AUTO);

            ImageRender rr = new ReadRender(inputStream, true);
            ImageRender dtr = new DrawTextRender(rr, drawParam);
            ImageRender sr = new ScaleRender(dtr, scaleParam);
            wr = new WriteRender(sr, output, outputFormat);

            wr.render();
        } catch (Exception e) {
            errorLog(inputStream);

            IOUtils.closeQuietly(output);

            if (e instanceof SimpleImageException) {
                throw (SimpleImageException) e;
            } else {
                throw new SimpleImageException(e);
            }
        } finally {
            try {
                if (wr != null) {
                    wr.dispose();
                }
            } catch (SimpleImageException ignore) {
            }
        }

        return output;
    }
117123
@Override
  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (!roundEnv.processingOver()) {
      for (TypeElement te : annotations) {
        for (Element elt : roundEnv.getElementsAnnotatedWith(te)) {
          if (!elt.toString().startsWith("org.apache.heron")) {
            env.getMessager().printMessage(
                Kind.WARNING,
                String.format("%s extends from a class annotated with %s", elt, te),
                elt);
          }
        }
      }
    }
    return true;
  }