mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-09-29 22:54:45 +00:00
tidying
This commit is contained in:
parent
e090ca8525
commit
c532516f23
@ -64,8 +64,7 @@ class Expression extends AbstractValue implements Iterable<Value>
|
|||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case '@': // function
|
case '@': // function
|
||||||
String functionText = getBalancedText (line.substring (ptr));
|
String functionText = getFunctionCall (line.substring (ptr));
|
||||||
// System.out.println ("Func : " + functionText);
|
|
||||||
ptr += functionText.length ();
|
ptr += functionText.length ();
|
||||||
values.add (Function.getInstance (parent, cell, functionText));
|
values.add (Function.getInstance (parent, cell, functionText));
|
||||||
break;
|
break;
|
||||||
@ -288,7 +287,7 @@ class Expression extends AbstractValue implements Iterable<Value>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// called for functions and expressions
|
// called for functions and expressions
|
||||||
static String getBalancedText (String text)
|
private String getBalancedText (String text)
|
||||||
{
|
{
|
||||||
int ptr = text.indexOf ('('); // find first left parenthesis
|
int ptr = text.indexOf ('('); // find first left parenthesis
|
||||||
if (ptr < 0)
|
if (ptr < 0)
|
||||||
@ -333,7 +332,7 @@ class Expression extends AbstractValue implements Iterable<Value>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// receives a string starting with the function call
|
// receives a string starting with the function call
|
||||||
static String getFunctionCall (String text)
|
private String getFunctionCall (String text)
|
||||||
{
|
{
|
||||||
if (text.charAt (0) != '@')
|
if (text.charAt (0) != '@')
|
||||||
throw new IllegalArgumentException ("Bad function name: " + text);
|
throw new IllegalArgumentException ("Bad function name: " + text);
|
||||||
|
@ -27,57 +27,6 @@ public class ValueList implements Iterable<Value>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ValueList (Sheet parent, Cell cell, String text)
|
|
||||||
// {
|
|
||||||
// this.parent = parent;
|
|
||||||
//
|
|
||||||
// int ptr = 0;
|
|
||||||
// while (ptr < text.length ())
|
|
||||||
// {
|
|
||||||
// if (text.charAt (ptr) == '@') // function
|
|
||||||
// {
|
|
||||||
// String functionText = Expression.getBalancedText (text.substring (ptr));
|
|
||||||
// Value v = new Expression (parent, cell, functionText).reduce ();
|
|
||||||
// values.add (v);
|
|
||||||
// ptr += functionText.length ();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// String item = getNextItem (text, ptr);
|
|
||||||
// int pos = item.indexOf ("...");
|
|
||||||
// if (pos > 0) // range
|
|
||||||
// {
|
|
||||||
// Address from = new Address (item.substring (0, pos));
|
|
||||||
// Address to = new Address (item.substring (pos + 3));
|
|
||||||
// Range range = new Range (parent, from, to);
|
|
||||||
//
|
|
||||||
// for (Address address : range)
|
|
||||||
// values.add (parent.getCell (address));
|
|
||||||
// }
|
|
||||||
// else // cell/number/expression
|
|
||||||
// {
|
|
||||||
// Value v = new Expression (parent, cell, item).reduce ();
|
|
||||||
// values.add (v);
|
|
||||||
// }
|
|
||||||
// ptr += item.length ();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (ptr < text.length () && text.charAt (ptr) == ',')
|
|
||||||
// ptr++;
|
|
||||||
// if (ptr < text.length () && text.charAt (ptr) == ')')
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return substring of text from ptr up to the next comma
|
|
||||||
// private String getNextItem (String text, int ptr)
|
|
||||||
// {
|
|
||||||
// int p = ptr;
|
|
||||||
// while (++p < text.length () && text.charAt (p) != ',')
|
|
||||||
// ;
|
|
||||||
// return text.substring (ptr, p);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public int size ()
|
public int size ()
|
||||||
{
|
{
|
||||||
return values.size ();
|
return values.size ();
|
||||||
|
Loading…
Reference in New Issue
Block a user