Skip to content

Commit

Permalink
Rename Empty.e to Empty.empty
Browse files Browse the repository at this point in the history
  • Loading branch information
tmmcguire committed Jun 7, 2012
1 parent fa3b99e commit 27c5433
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/net/crsr/derivative/c/Alternative.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public class Alternative extends Fix

public static Parser alternative(Parser l1, Parser l2)
{
if (l1 == Empty.e)
if (l1 == Empty.empty)
{
return l2;
}
else if (l2 == Empty.e)
else if (l2 == Empty.empty)
{
return l1;
}
Expand Down Expand Up @@ -54,11 +54,11 @@ public Parser compact(Set seen)
l1 = l1.compact(seen);
l2 = l2.compact(seen);
}
if (l1 == Empty.e)
if (l1 == Empty.empty)
{
return l2;
}
else if (l2 == Empty.e)
else if (l2 == Empty.empty)
{
return l1;
}
Expand Down
8 changes: 4 additions & 4 deletions src/net/crsr/derivative/c/Concat.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class Concat extends Fix

public static Parser concat(Parser l1, Parser l2)
{
if (l1 == Empty.e || l2 == Empty.e)
if (l1 == Empty.empty || l2 == Empty.empty)
{
return Empty.e;
return Empty.empty;
}
else
{
Expand Down Expand Up @@ -60,9 +60,9 @@ public Parser compact(Set seen)
l1 = l1.compact(seen);
l2 = l2.compact(seen);
}
if (l1 == Empty.e || l2 == Empty.e)
if (l1 == Empty.empty || l2 == Empty.empty)
{
return Empty.e;
return Empty.empty;
}
else if (l1 instanceof Epsilon && ((Epsilon) l1).size() == 1)
{
Expand Down
2 changes: 1 addition & 1 deletion src/net/crsr/derivative/c/Delta.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Delta extends Parser
@Override
public Parser derive(char ch)
{
return Empty.e;
return Empty.empty;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/net/crsr/derivative/c/Empty.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

public class Empty extends Parser
{
public static final Empty e = new Empty();
public static final Empty empty = new Empty();

@Override
public Parser derive(char ch)
{
return e;
return empty;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/net/crsr/derivative/c/Epsilon.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static Parser epsilon(Set trees)
{
if (trees.isEmpty())
{
return Empty.e;
return Empty.empty;
}
else if (trees.size() == 1 && trees.contains(""))
{
Expand Down Expand Up @@ -47,7 +47,7 @@ private Epsilon(Set trees)
@Override
public Parser derive(char ch)
{
return Empty.e;
return Empty.empty;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/net/crsr/derivative/c/Literal.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public Literal(char ch)
@Override
public Parser derive(char ch)
{
return this.ch == ch ? Epsilon.epsilon(ch) : Empty.e;
return this.ch == ch ? Epsilon.epsilon(ch) : Empty.empty;
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion src/net/crsr/derivative/c/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Object reduce(Object t)
GraphWriter.writeGraph("/tmp/S" + i++ + ".dot", a);
}
System.out.println( a.deriveNull() );
System.out.println();

Recurrence term = new Recurrence();
Parser one = new Literal('1');
Expand All @@ -65,6 +66,7 @@ public Object reduce(Object t)
GraphWriter.writeGraph("/tmp/l" + (++i) + ".dot", l);
}
System.out.println( l.deriveNull() );
}
System.out.println();
}

}
4 changes: 2 additions & 2 deletions src/net/crsr/derivative/c/Reduce.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public Parser compact(Set seen)
final Reduction combination = new Reduction<Object,Object>() { @Override public Object reduce(Object t) { return outer.reduce( inner.reduce(t) ); } };
return new Reduce(subReduction.parser,combination);
}
else if (parser == Empty.e)
else if (parser == Empty.empty)
{
return Empty.e;
return Empty.empty;
}
else
{
Expand Down

0 comments on commit 27c5433

Please sign in to comment.