public abstract static class MExpression
{} public abstract static class MFieldReferenceExpression extends MExpression
{
	public MExpression object;
	public String field;
	abstract String toStringLhOnly();
	abstract String toStringRhOnly();
} public static class MFieldReferenceExpressionPlain extends MFieldReferenceExpression
{
	@Override
	public String toString() 
	{
		return String.format("%s.%s", this.object, this.field);
	}
		
	@Override
	String toStringLhOnly() 
	{
		return this.object.toString();
	}

	@Override
	String toStringRhOnly() 
	{
		return this.field;
	}
} public static class MFunctionCallExpression extends MFunctionCallExpressionParent
{
	@Override
	public String toString() 
	{
		return String.format("%s(%s)", this.name, joinExpressions(this.args));
	}
} public abstract static class MIdentityExpression extends MExpression implements PlainString
{
	public String ident;
} public static class MIdentityExpressionNumber extends MIdentityExpression
{
	@Override
	public String toString() 
	{
		return String.format("%s.get()", this.ident);
	}
		
	@Override
	public String toStringPlain()
	{
		return String.format("%s", this.ident);
	}
} public static class MIdentityExpressionPlain extends MIdentityExpression
{
	@Override
	public String toString() 
	{
		return String.format("%s", this.ident);
	}

	@Override
	public String toStringPlain() 
	{
		return this.toString();
	}
} public abstract static class MInfixExpression extends MExpression
{
	public MExpression left;
	public MExpression right;
	public String operator;
} public static class MInfixExpressionPlain extends MInfixExpression
{
	@Override
	public String toString() 
	{
		return String.format("%s %s %s", this.left, this.operator, this.right);
	}
} public static class MInfixExpressionPtrComparison extends MInfixExpression
{
	@Override
	public String toString() 
	{
		String right2 = getPlainString(this.right);
		String left2 = getPlainString(this.left);
			
		if (right2 != null)
		{
			right2 = String.format("%s.ptrCompare()", right2);
		}
		else
		{
			String lhs = getStringLhs(this.right);
			String rhs = getStringRhs(this.right);
				
			right2 = String.format("%s.%s.ptrCompare()", lhs, rhs);				
		}
			
		if (left2 != null)
		{
			left2 = String.format("%s.ptrCompare()", left2);
		}
		else
		{
			String lhs = getStringLhs(this.left);
			String rhs = getStringRhs(this.left);
				
			left2 = String.format("%s.%s.ptrCompare()", lhs, rhs);				
		}
			
		return String.format("%s %s %s", left2, this.operator, right2);
	}		
} public static class MLiteralExpression extends MExpression
{
	public String literal;
		
	@Override
	public String toString() 
	{
		return literal;
	}
} public class MExprStmt extends MStmt
{
	public MExpression expr;
		
	@Override
	public String toString()
	{
		return String.format("%s%s;\n", tabOut(), this.expr);
	}
} public abstract static class MStmt {}
import java.util.Arrays;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MExpression;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MFieldReferenceExpression;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MFieldReferenceExpressionPlain;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MFunctionCallExpression;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MIdentityExpression;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MIdentityExpressionNumber;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MIdentityExpressionPlain;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MInfixExpression;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MInfixExpressionPlain;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MInfixExpressionPtrComparison;
import com.github.danfickle.cpptojavasourceconverter.models.ExpressionModels.MLiteralExpression;
import com.github.danfickle.cpptojavasourceconverter.models.StmtModels.MExprStmt;
import com.github.danfickle.cpptojavasourceconverter.models.StmtModels.MStmt;
package com.github.danfickle.cpptojavasourceconverter;



public class ModelCreation
{
	/**
	 * Results in obj1.obj2.method(args) 
	 */
	static MStmt createMethodCall(TranslationUnitContext ctx, String obj1, String obj2, String method, MExpression... args)
	{
		MFieldReferenceExpression fr1 = createFieldReference(obj1, obj2);
		MFieldReferenceExpression fr2 = createFieldReference(fr1, method);
		MFunctionCallExpression fcall = new MFunctionCallExpression();

		fcall.name = fr2;
		fcall.args = Arrays.asList(args);
	
		return 	createExprStmt(ctx, fcall);
	}
	
	/**
	 * Results in literal as expression.
	 */
	static MLiteralExpression createLiteral(String literal)
	{
		MLiteralExpression lit1 = new MLiteralExpression();		
		lit1.literal = literal;
		return lit1;
	}
	
	static MIdentityExpression createId(String name)
	{
		MIdentityExpressionPlain ident = new MIdentityExpressionPlain();
		ident.ident = name;
		return ident;
	}

	static MIdentityExpression createNumberId(String name)
	{
		MIdentityExpressionNumber ident = new MIdentityExpressionNumber();