Java Doc for FoldUtilities.java in  » IDE-Netbeans » editor » org » netbeans » api » editor » fold » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » editor » org.netbeans.api.editor.fold 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.api.editor.fold.FoldUtilities

FoldUtilities
final public class FoldUtilities (Code)
Various utility methods for dealing with the folds.

Note: Until explicitly noted all the utility methods require a lock to be held on the FoldHierarchy during execution of the methods.
author:
   Miloslav Metelka
version:
   1.00





Method Summary
public static  ListchildrenAsList(Fold fold)
     Return children of the given fold as modifiable list.
FoldUtilities.findRecursive(Fold) can be used to collect children recursively.
Parameters:
  fold - fold which children will be returned.
public static  ListchildrenAsList(Fold fold, int index, int count)
     Return children of the given fold as list.
Parameters:
  fold - fold which children will be returned.
Parameters:
  index - >=0 index of the first child to be returned.
Parameters:
  count - >=0 number of children to be returned.index + count <= Fold.getFoldCount.
public static  Fold[]childrenToArray(Fold fold)
     Return children of the given fold as array.
Parameters:
  fold - fold which children will be returned.
public static  Fold[]childrenToArray(Fold fold, int index, int count)
     Return children of the given fold as array.
Parameters:
  fold - fold which children will be returned.
Parameters:
  index - >=0 index of the first child to be returned.
Parameters:
  count - >=0 number of children to be returned.index + count <= Fold.getFoldCount.
public static  voidcollapse(FoldHierarchy hierarchy, FoldType type)
     Collapse all folds of the given type.
public static  voidcollapse(FoldHierarchy hierarchy, Collection foldTypes)
     Collapse all folds that having any of the fold types in the given collection.
public static  voidcollapseAll(FoldHierarchy hierarchy)
     Collapse all folds in the hierarchy.
public static  IteratorcollapsedFoldIterator(FoldHierarchy hierarchy, int startOffset, int endOffset)
     Get iterator over the collapsed folds.
Parameters:
  hierarchy - hierarchy in which to search.
Parameters:
  startOffset - >=0 only folds ending above it will be returned.
Parameters:
  endOffset - >=0 only folds starting before it will be returned.
public static  booleancontainsOffset(Fold fold, int offset)
     Check whether fold contains the given offset.
Parameters:
  fold - fold to be tested for containing the given offset
Parameters:
  offset - that will be tested for being contained in the given fold.
public static  voidexpand(FoldHierarchy hierarchy, FoldType type)
     Expand all folds of the given type.
public static  voidexpand(FoldHierarchy hierarchy, Collection foldTypes)
     Expand all folds of the given type (or all folds if the type is null) found in the whole fold hierarchy.
public static  voidexpandAll(FoldHierarchy hierarchy)
     Expand all folds in the hierarchy.
public static  Listfind(Fold fold, FoldType foldType)
     Find direct subfolds of the given fold having certain type.
Complexity corresponds to number of direct child folds under the given fold.
Parameters:
  fold - direct children of this fold will be searched.The search is *not* recursive in grandchildren etc.
Parameters:
  foldType - non-null fold type to search for.
public static  Listfind(Fold fold, Collection foldTypes)
     Find direct subfolds of the given fold having any of the fold types in the given collection.
Complexity corresponds to number of direct child folds under the given fold.
Parameters:
  fold - direct children of this fold will be searched.The search is *not* recursive in grandchildren etc.
Parameters:
  foldTypes - collection of fold types to search for.
public static  FoldfindCollapsedFold(FoldHierarchy hierarchy, int startOffset, int endOffset)
     Find a first collapsed fold by going from top-level folds to more nested ones within the requested bounds.
public static  intfindFoldEndIndex(Fold fold, int offset)
     Find index of the first child of the given fold that ends above the given offset ("contains" the offset).

This method uses binary search and has log2(n) performance where n is number of children of the given fold.
The efficiency may drop to linear if there would be many empty folds at the given offset.
Parameters:
  fold - fold which children will be inspected.
Parameters:
  offset - >=0 offset in the document for which the representingchild will be searched.

public static  intfindFoldStartIndex(Fold fold, int offset)
     Find index of the child of the given fold that starts right at or below the given offset.

This method uses binary search and has log2(n) performance where n is number of children of the given fold.
The efficiency may drop to linear if there would be many empty folds at the given offset.
Parameters:
  fold - fold which children will be inspected.
Parameters:
  offset - >=0 offset in the document for which the representingchild will be searched.

public static  FoldfindNearestFold(FoldHierarchy hierarchy, int offset)
     Find nearest fold that either starts right at or follows the given offset.
The search deep-dives into hierarchy.
Parameters:
  offset - >=0 offset in a document.
public static  FoldfindOffsetFold(FoldHierarchy hierarchy, int offset)
     Find a deepest fold in the hierarchy which contains the offset or has it as one of its boundaries.
The search deep-dives into hierarchy.
Parameters:
  offset - >=0 offset in a document.
public static  ListfindRecursive(Fold fold)
     Collect all children of the given fold recursively.
Complexity corresponds to number of all child folds (including grandchildren etc.) under the given fold.
Parameters:
  fold - all children of this fold will be collected.
public static  ListfindRecursive(Fold fold, FoldType foldType)
     Recursively find any subfolds of the given fold having certain type.
Complexity corresponds to number of all child folds (including grandchildren etc.) under the given fold.
Parameters:
  fold - all children of this fold will be searched.The search is recursive into grandchildren etc.
Parameters:
  foldType - non-null fold type to search for.
public static  ListfindRecursive(Fold fold, Collection foldTypes)
     Recursively find any subfolds of the given fold having any of the fold types in the given collection.
Complexity corresponds to number of all child folds (including grandchildren etc.) under the given fold.
Parameters:
  fold - all children of this fold will be searched.The search is recursive into grandchildren etc.
Parameters:
  foldTypes - collection of fold types to search for.
public static  booleanisEmpty(Fold fold)
     Check whether the starting offset of the fold is the same like its ending offset.
Parameters:
  fold - fold that should be checked whether it's empty.
public static  booleanisRootFold(Fold fold)
     Is the given fold a root fold?
Parameters:
  fold - non-null fold which is either root fold or a regular fold.



Method Detail
childrenAsList
public static List childrenAsList(Fold fold)(Code)
Return children of the given fold as modifiable list.
FoldUtilities.findRecursive(Fold) can be used to collect children recursively.
Parameters:
  fold - fold which children will be returned. non-null modifiable list of all child folds.



childrenAsList
public static List childrenAsList(Fold fold, int index, int count)(Code)
Return children of the given fold as list.
Parameters:
  fold - fold which children will be returned.
Parameters:
  index - >=0 index of the first child to be returned.
Parameters:
  count - >=0 number of children to be returned.index + count <= Fold.getFoldCount. non-null list of selected child folds.
The list can potentially be further modified by the caller withoutany effect on the fold hierarchy.



childrenToArray
public static Fold[] childrenToArray(Fold fold)(Code)
Return children of the given fold as array.
Parameters:
  fold - fold which children will be returned. non-null array of all child folds.



childrenToArray
public static Fold[] childrenToArray(Fold fold, int index, int count)(Code)
Return children of the given fold as array.
Parameters:
  fold - fold which children will be returned.
Parameters:
  index - >=0 index of the first child to be returned.
Parameters:
  count - >=0 number of children to be returned.index + count <= Fold.getFoldCount. non-null array of selected child folds.



collapse
public static void collapse(FoldHierarchy hierarchy, FoldType type)(Code)
Collapse all folds of the given type.
This method does the necessary locking of the document and hierarchy.
Parameters:
  hierarchy - hierarchy under which the folds should be collapsed.
Parameters:
  type - folds with this type will be collapsed.



collapse
public static void collapse(FoldHierarchy hierarchy, Collection foldTypes)(Code)
Collapse all folds that having any of the fold types in the given collection.
This method does the necessary locking of the document and hierarchy.
Parameters:
  hierarchy - hierarchy under which the folds should be collapsed.
Parameters:
  foldTypes - collection of fold types to search for.



collapseAll
public static void collapseAll(FoldHierarchy hierarchy)(Code)
Collapse all folds in the hierarchy.
This method does the necessary locking of the document and hierarchy.
Parameters:
  hierarchy - hierarchy under which all folds should be collapsed.



collapsedFoldIterator
public static Iterator collapsedFoldIterator(FoldHierarchy hierarchy, int startOffset, int endOffset)(Code)
Get iterator over the collapsed folds.
Parameters:
  hierarchy - hierarchy in which to search.
Parameters:
  startOffset - >=0 only folds ending above it will be returned.
Parameters:
  endOffset - >=0 only folds starting before it will be returned. iterator over collapsed folds satisfyingfold.getEndOffset() > startOffset and fold.getStartOffset() < endOffset
If a particular collapsed fold gets returned then its childrenare not deep-dived for collapsed folds. Instead the search continuesby a following sibling.



containsOffset
public static boolean containsOffset(Fold fold, int offset)(Code)
Check whether fold contains the given offset.
Parameters:
  fold - fold to be tested for containing the given offset
Parameters:
  offset - that will be tested for being contained in the given fold. true if offset >= fold.getStartOffset()&& offset < fold.getEndOffset()



expand
public static void expand(FoldHierarchy hierarchy, FoldType type)(Code)
Expand all folds of the given type.
This method does the necessary locking of the document and hierarchy.
Parameters:
  hierarchy - hierarchy under which the folds should be expanded.
Parameters:
  type - folds with this type will be expanded.



expand
public static void expand(FoldHierarchy hierarchy, Collection foldTypes)(Code)
Expand all folds of the given type (or all folds if the type is null) found in the whole fold hierarchy.
This method does the necessary locking of the document and hierarchy.
Parameters:
  hierarchy - hierarchy under which the folds should be expanded.
Parameters:
  foldTypes - collection of fold types to search for.



expandAll
public static void expandAll(FoldHierarchy hierarchy)(Code)
Expand all folds in the hierarchy.
This method does the necessary locking of the document and hierarchy.
Parameters:
  hierarchy - hierarchy under which all folds should be expanded.



find
public static List find(Fold fold, FoldType foldType)(Code)
Find direct subfolds of the given fold having certain type.
Complexity corresponds to number of direct child folds under the given fold.
Parameters:
  fold - direct children of this fold will be searched.The search is *not* recursive in grandchildren etc.
Parameters:
  foldType - non-null fold type to search for. non-null list of folds matching the criteria.
The list can potentially be further modified by the caller withoutany effect on the fold hierarchy.



find
public static List find(Fold fold, Collection foldTypes)(Code)
Find direct subfolds of the given fold having any of the fold types in the given collection.
Complexity corresponds to number of direct child folds under the given fold.
Parameters:
  fold - direct children of this fold will be searched.The search is *not* recursive in grandchildren etc.
Parameters:
  foldTypes - collection of fold types to search for. non-null list of folds matching the criteria.
The list can potentially be further modified by the caller withoutany effect on the fold hierarchy.



findCollapsedFold
public static Fold findCollapsedFold(FoldHierarchy hierarchy, int startOffset, int endOffset)(Code)
Find a first collapsed fold by going from top-level folds to more nested ones within the requested bounds. Once a collapsed fold is found it is returned (its children even if they would be collapsed are not inspected).
Parameters:
  hierarchy - hierarchy in which to search.
Parameters:
  startOffset - >=0 only fold ending above it will be returned.
Parameters:
  endOffset - >=0 only fold starting below it will be returned. collapsed fold satisfyingfold.getEndOffset() > startOffset and fold.getStartOffset() < endOffsetor null if such fold does not exist.



findFoldEndIndex
public static int findFoldEndIndex(Fold fold, int offset)(Code)
Find index of the first child of the given fold that ends above the given offset ("contains" the offset).

This method uses binary search and has log2(n) performance where n is number of children of the given fold.
The efficiency may drop to linear if there would be many empty folds at the given offset.
Parameters:
  fold - fold which children will be inspected.
Parameters:
  offset - >=0 offset in the document for which the representingchild will be searched. index of the child fold that contains or is above the given offset.
A highest index is returned for whichoffset < getFold(index).getEndOffset()
or fold.getFoldCount() in case there is no such fold.




findFoldStartIndex
public static int findFoldStartIndex(Fold fold, int offset)(Code)
Find index of the child of the given fold that starts right at or below the given offset.

This method uses binary search and has log2(n) performance where n is number of children of the given fold.
The efficiency may drop to linear if there would be many empty folds at the given offset.
Parameters:
  fold - fold which children will be inspected.
Parameters:
  offset - >=0 offset in the document for which the representingchild will be searched. index of the child fold that represents the given offset.
An index is returnedif offset >= getFold(index).getStartOffset()and offset <= getFold(index + 1).getStartOffset().
-1 is returnedif offset < getFold(0).getStartOffset()and in case the fold does not have any children.




findNearestFold
public static Fold findNearestFold(FoldHierarchy hierarchy, int offset)(Code)
Find nearest fold that either starts right at or follows the given offset.
The search deep-dives into hierarchy.
Parameters:
  offset - >=0 offset in a document. fold in the hierarchy that starts directly at the offset or follows it.The most important is the lowest distance of the start of the foldto the given offset. If there would be a nearest fold having a first child thatstarts at the same position like the parentthen the parent would be returned.



findOffsetFold
public static Fold findOffsetFold(FoldHierarchy hierarchy, int offset)(Code)
Find a deepest fold in the hierarchy which contains the offset or has it as one of its boundaries.
The search deep-dives into hierarchy.
Parameters:
  offset - >=0 offset in a document. deepset fold in the hierarchy satisfyingfold.getStartOffset() >= offset && offset <= fold.getEndOffset()or null if there is no such fold (except the root fold) satisfying the condition.
For two consecutive folds (one ending at the offset and the next onestarting at the offset) the latter fold would be returned.



findRecursive
public static List findRecursive(Fold fold)(Code)
Collect all children of the given fold recursively.
Complexity corresponds to number of all child folds (including grandchildren etc.) under the given fold.
Parameters:
  fold - all children of this fold will be collected. non-null list of folds matching the criteria.
The list can potentially be further modified by the caller withoutany effect on the fold hierarchy.



findRecursive
public static List findRecursive(Fold fold, FoldType foldType)(Code)
Recursively find any subfolds of the given fold having certain type.
Complexity corresponds to number of all child folds (including grandchildren etc.) under the given fold.
Parameters:
  fold - all children of this fold will be searched.The search is recursive into grandchildren etc.
Parameters:
  foldType - non-null fold type to search for. non-null list of folds matching the criteria.
The list can potentially be further modified by the caller withoutany effect on the fold hierarchy.



findRecursive
public static List findRecursive(Fold fold, Collection foldTypes)(Code)
Recursively find any subfolds of the given fold having any of the fold types in the given collection.
Complexity corresponds to number of all child folds (including grandchildren etc.) under the given fold.
Parameters:
  fold - all children of this fold will be searched.The search is recursive into grandchildren etc.
Parameters:
  foldTypes - collection of fold types to search for. non-null list of folds matching the criteria.
The list can potentially be further modified by the caller withoutany effect on the fold hierarchy.



isEmpty
public static boolean isEmpty(Fold fold)(Code)
Check whether the starting offset of the fold is the same like its ending offset.
Parameters:
  fold - fold that should be checked whether it's empty. true if the fold is empty or false otherwise.



isRootFold
public static boolean isRootFold(Fold fold)(Code)
Is the given fold a root fold?
Parameters:
  fold - non-null fold which is either root fold or a regular fold. true if the given fold is root fold or false otherwise.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.