products/Sources/formale Sprachen/JAVA/openjdk-20-36_src/test/jdk/java/io/File image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: context.xml   Sprache: XML

Untersuchungsergebnis.bsh Download desScala {Scala[98] Latech[132] Ada[145]}zum Wurzelverzeichnis wechseln

/**
 * Single_Space_Buffer.bsh - A Beanshell macro for jEdit that 
 * converts a buffer from being double-spaced (where every second
 * line is blank) to single-spaced, by removing each second line -
 * but only if they're all blank.
 *
 * Copyright (C) 2004 Ollie Rutherfurd <[email protected]>
 *
 * $Id: Single_Space_Buffer.bsh 21381 2012-03-15 20:02:15Z jojaba_67 $
 */


// Localization
final static String NotDoubleSpacedMessage = jEdit.getProperty("macro.rs.SingleSpaceBuffer.NotDoubleSpaced.message""doesn't appear to be double-spaced:");
final static String LineMessage = jEdit.getProperty("macro.rs.SingleSpaceBuffer.Line.message""Line");
final static String NotBlankMessage = jEdit.getProperty("macro.rs.SingleSpaceBuffer.NotBlank.message""isn't blank."); 

// Process
void singleSpaceBuffer(View view)
{
 Buffer buffer = view.getBuffer();
 int line = 1; // start on second line
 Vector lines = new java.util.Stack();

 while(line < buffer.getLineCount())
 {
  if(buffer.getLineText(line).equals(""))
   lines.addElement(new Integer(line));
  else
  {
   StringBuffer msg = new StringBuffer();
   msg.append(buffer.getPath() + " " + NotDoubleSpacedMessage + "\n");
   msg.append(LineMessage + " " + (line + 1) + " " + NotBlankMessage);
   Macros.error(view, msg.toString());
   return;
  }
  line += 2;
 }
 while(!lines.empty())
 {
  Integer lineno = (Integer)lines.pop();
  int offset = buffer.getLineStartOffset(lineno.intValue());
  buffer.remove(offset-1,1);
 }
}

singleSpaceBuffer(view);

/*

<listitem>
<para><filename>Single_Space_Buffer.bsh</filename></para>
<abstract><para>
Removes every second line, if they are all blank.
</para></abstract>
</listitem>

*/


[ zur Elbe Produktseite wechseln0.132Quellennavigators  ]