Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.text.source
Class DefaultCharacterPairMatcher

java.lang.Object
  extended by 
org.eclipse.jface.text.source.DefaultCharacterPairMatcher
All Implemented Interfaces:
ICharacterPairMatcher

public class DefaultCharacterPairMatcher
extends Object
implements ICharacterPairMatcher

A character pair matcher that matches a specified set of character pairs against each other. Only characters that occur in the same partitioning are matched.

Since:
3.3

Field Summary
 
Fields inherited from interface org.eclipse.jface.text.source. ICharacterPairMatcher
LEFT, RIGHT
 
Constructor Summary
DefaultCharacterPairMatcher (char[] chars)
          Creates a new character pair matcher that matches characters within the default partitioning.
DefaultCharacterPairMatcher (char[] chars, String partitioning)
          Creates a new character pair matcher that matches the specified characters within the specified partitioning.
 
Method Summary
 void clear ()
          Clears this pair matcher.
 void dispose ()
          Disposes this pair matcher.
 int getAnchor ()
          Returns the anchor for the region of the matching peer characters.
  IRegion match ( IDocument doc, int offset)
          Starting at the given offset, the matcher chooses a character close to this offset.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCharacterPairMatcher

public DefaultCharacterPairMatcher(char[] chars,
                                   
String partitioning)
Creates a new character pair matcher that matches the specified characters within the specified partitioning. The specified list of characters must have the form
{ start, end, start, end, ..., start, end }
For instance:
 char[] chars = new char[] {'(', ')', '{', '}', '[', ']'};
 new SimpleCharacterPairMatcher(chars, ...);
 

Parameters:
chars - a list of characters
partitioning - the partitioning to match within

DefaultCharacterPairMatcher

public DefaultCharacterPairMatcher(char[] chars)
Creates a new character pair matcher that matches characters within the default partitioning. The specified list of characters must have the form
{ start, end, start, end, ..., start, end }
For instance:
 char[] chars = new char[] {'(', ')', '{', '}', '[', ']'};
 new SimpleCharacterPairMatcher(chars);
 

Parameters:
chars - a list of characters
Method Detail

match

public 
IRegion match(
IDocument doc,
                     int offset)
Description copied from interface: ICharacterPairMatcher
Starting at the given offset, the matcher chooses a character close to this offset. The matcher then searches for the matching peer character of the chosen character and if it finds one, returns the minimal region of the document that contains both characters. It returns null if there is no peer character.

Specified by:
match in interface ICharacterPairMatcher
Parameters:
doc - the document to work on
offset - the start offset
Returns:
the minimal region containing the peer characters

getAnchor

public int getAnchor()
Description copied from interface: ICharacterPairMatcher
Returns the anchor for the region of the matching peer characters. The anchor says whether the character that has been chosen to search for its peer character has been left or right of the initial offset.

Specified by:
getAnchor in interface ICharacterPairMatcher
Returns:
RIGHT or LEFT

dispose

public void dispose()
Description copied from interface: ICharacterPairMatcher
Disposes this pair matcher.

Specified by:
dispose in interface ICharacterPairMatcher

clear

public void clear()
Description copied from interface: ICharacterPairMatcher
Clears this pair matcher. I.e. the matcher throws away all state it might remember and prepares itself for a new call of the match method.

Specified by:
clear in interface ICharacterPairMatcher

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire