Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ obj
Release
Debug


_ReSharper*
34 changes: 34 additions & 0 deletions LibSvm/JavaPorts/StringTokenizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibSvm.JavaPorts
{
class StringTokenizer
{
private readonly IList<string> _tokens;
private int currentToken = -1;
private static readonly char[] DefaultDelimeters = new[] {' ', '\t', '\n', '\r', '\f',};

public StringTokenizer(string untokenizedString) : this(untokenizedString, DefaultDelimeters)
{
}

public StringTokenizer(string untokenizedString, char[] delimiters)
{
_tokens = untokenizedString.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
}

public string NextToken()
{
currentToken++;
return _tokens[currentToken];
}

public int CountTokens()
{
return _tokens.Count - currentToken;
}
}
}
1 change: 1 addition & 0 deletions LibSvm/LibSvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<Compile Include="Cache.cs" />
<Compile Include="Common.cs" />
<Compile Include="DecisionFunction.cs" />
<Compile Include="JavaPorts\StringTokenizer.cs" />
<Compile Include="Kernel.cs" />
<Compile Include="KernelType.cs" />
<Compile Include="OneClassQ.cs" />
Expand Down
Loading