Class Trim

  extended by dk.brics.string.stringoperations.Operation
      extended by dk.brics.string.stringoperations.UnaryOperation
          extended by dk.brics.string.stringoperations.Trim

public class Trim
extends UnaryOperation

Automaton operation for String.trim().

Constructor Summary
          Constructs new operation object.
Method Summary
 CharSet charsetTransfer(CharSet a)
          Transfer function for character set analysis.
 boolean equals(Object obj)
 int getPriority()
          Returns priority of this operation.
 int hashCode()
 Automaton op(Automaton a)
          Automaton operation.
 String toString()
          Returns name of this operation.
Methods inherited from class dk.brics.string.stringoperations.UnaryOperation
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public Trim()
Constructs new operation object.

Method Detail


public CharSet charsetTransfer(CharSet a)
Description copied from class: UnaryOperation
Transfer function for character set analysis.

Specified by:
charsetTransfer in class UnaryOperation


public boolean equals(Object obj)
equals in class Object


public int getPriority()
Description copied from class: Operation
Returns priority of this operation. When approximating operation loops in grammars, operations with high priority are considered first.

Specified by:
getPriority in class Operation


public int hashCode()
hashCode in class Object


public Automaton op(Automaton a)
Automaton operation. Constructs new automaton as copy of a with a new initial state and a new accept state. Non-epsilon transitions are added from the new initial state to states that are reachable from the old initial state in zero or more special chars followed by one non-special char, thereby skipping initial special chars. Similarly, non-epsilon transitions are added from states that can reach the old final state in one non-special char followed by zero or more special chars to the new final state, thereby skipping final special chars. ("Special" chars are those with value less than or equal to 0x20.) The new initial state is accepting if the old one could reach an accept state by zero or more special chars.

Specified by:
op in class UnaryOperation
a - input automaton
resulting automaton


public String toString()
Description copied from class: Operation
Returns name of this operation.

Specified by:
toString in class Operation

Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.