2017-09-23 23:43:08 -07:00
|
|
|
package org.nwapw.abacus.tree.nodes
|
2017-08-25 01:17:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a more generic function call.
|
|
|
|
*
|
|
|
|
* This class does not specify how it should be reduced, allowing other classes
|
|
|
|
* to extend this functionality.
|
|
|
|
*
|
|
|
|
* @param callTo the name of the things being called.
|
2017-09-07 12:31:40 -07:00
|
|
|
* @param children the children of this node.
|
2017-08-25 01:17:52 -07:00
|
|
|
*/
|
2017-09-07 12:31:40 -07:00
|
|
|
abstract class CallNode(val callTo: String, val children: List<TreeNode>) : TreeNode() {
|
2017-08-25 01:17:52 -07:00
|
|
|
|
|
|
|
override fun toString(): String {
|
|
|
|
val buffer = StringBuffer()
|
|
|
|
buffer.append(callTo)
|
|
|
|
buffer.append("(")
|
2017-08-26 12:19:34 -07:00
|
|
|
for (i in 0 until children.size) {
|
2017-08-25 01:17:52 -07:00
|
|
|
buffer.append(children[i].toString())
|
2017-08-26 12:19:34 -07:00
|
|
|
buffer.append(if (i != children.size - 1) ", " else ")")
|
2017-08-25 01:17:52 -07:00
|
|
|
}
|
|
|
|
return buffer.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|