Changeset 1229


Ignore:
Timestamp:
Jul 20, 2011, 6:58:45 PM (6 years ago)
Author:
stefan
Message:
 
Location:
trunk/src/jlatexeditor/codehelper
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/jlatexeditor/codehelper/CommandsCodeHelper.java

    r1071 r1229  
    11package jlatexeditor.codehelper;
    22
     3import de.endrullis.utils.ExtIterable;
    34import de.endrullis.utils.ExtIterator;
     5import jlatexeditor.PackagesExtractor;
    46import jlatexeditor.SCEManager;
    57import sce.codehelper.CHCommand;
    68import sce.codehelper.StaticCommandsCodeHelper;
     9import util.Function1;
     10import util.MergeSortIterable;
    711import util.Trie;
    812
     
    2226
    2327  @Override
    24   public Iterable<? extends CHCommand> getCompletions(String prefix) {
     28  public Iterable<CHCommand> getCompletions(String prefix) {
     29    /*
     30    ExtIterable<String> userIter = SCEManager.getBackgroundParser().getCommands().getObjectsIterable(search).map(COMMAND_2_STRING_FUNCTION);
     31    int minUsageCount = 0;
     32    ExtIterable<String> packEnvIter = PackagesExtractor.getPackageParser().getEnvironments().getTrieSetIterator(search).filter(minUsage(minUsageCount)).map(TRIE_SET_2_STRING_FUNCTION);
     33    ExtIterable<String> dcEnvIter = PackagesExtractor.getDocClassesParser().getEnvironments().getTrieSetIterator(search).filter(minUsage(minUsageCount)).map(TRIE_SET_2_STRING_FUNCTION);
     34
     35    ExtIterable<CHCommand> mergedIter = new MergeSortIterable<String>(STRING_COMPARATOR, userIter, packEnvIter, dcEnvIter).map(STRING_2_CHCOMMAND);
     36
     37    return mergedIter.toList(20);
     38    */
     39
    2540    ArrayList<CHCommand> dynamicCommands = new ArrayList<CHCommand>();
    2641    BackgroundParser backgroundParser = SCEManager.getBackgroundParser();
  • trunk/src/jlatexeditor/codehelper/EnvironmentCodeHelper.java

    r1226 r1229  
    1919 * @author Stefan Endrullis &lt;stefan@endrullis.de&gt;
    2020 */
    21 public class EnvironmentCodeHelper extends PatternHelper {
    22   private static final Comparator<String> STRING_COMPARATOR = new Comparator<String>() {
    23     @Override
    24     public int compare(String o1, String o2) {
    25       return o1.compareTo(o2);
    26     }
    27   };
    28   private static final Function1<TrieSet<PackagesExtractor.Environment>,String> TRIE_SET_2_STRING_FUNCTION = new Function1<TrieSet<PackagesExtractor.Environment>, String>() {
    29     @Override
    30     public String apply(TrieSet<PackagesExtractor.Environment> trieSet) {
    31       return trieSet.getObjects().iterator().next().getName();
    32     }
    33   };
    34   private static final Function1<String,CHCommand> STRING_2_CHCOMMAND = new Function1<String, CHCommand>() {
    35     public CHCommand apply(String packageName) {
    36       return new ValueCompletion(packageName);
    37     }
    38   };
    39   private static final Function1<Environment,String> ENVIRONMENT_2_STRING_FUNCTION = new Function1<Environment, String>() {
    40     public String apply(Environment env) {
    41       return env.getName();
    42     }
    43   };
    44 
     21public class EnvironmentCodeHelper extends ExtPatternHelper {
    4522  protected WordWithPos word;
    4623
     
    9168  }
    9269
    93   private Function1<TrieSet<PackagesExtractor.Environment>, Boolean> minUsage(final int minUsageCount) {
     70  protected Function1<TrieSet<PackagesExtractor.Environment>, Boolean> minUsage(final int minUsageCount) {
    9471    return new Function1<TrieSet<PackagesExtractor.Environment>, Boolean>() {
    9572      @Override
Note: See TracChangeset for help on using the changeset viewer.