All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mapforce.core.get_fileext Maven / Gradle / Ivy

/**
 * core/get_fileext.java
 *
 * This file was generated by MapForce 2017sp2.
 *
 * YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
 * OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
 *
 * Refer to the MapForce Documentation for further details.
 * http://www.altova.com/mapforce
 */
package com.mapforce.core;
import com.altova.mapforce.*;
import com.altova.types.*;
import com.altova.xml.*;
import com.altova.text.tablelike.*;
import com.altova.text.*;
import com.altova.text.edi.*;
import java.util.*;

public class get_fileext extends com.altova.TraceProvider 
{

	
	static class main implements IEnumerable
	{
		java.lang.String var1_filepath;
	
		public main(java.lang.String var1_filepath)
		{
			this.var1_filepath = var1_filepath;
		}

		public IEnumerator enumerator() {return new Enumerator(this);}
		
		public static class Enumerator implements IEnumerator
		{
			int pos = 0;
			int state = 2;
			Object current;
			main closure;
			public Enumerator(main closure) 
			{
				this.closure = closure;
			}
			
			public Object current() {return current;}
			
			public int position() {return pos;}
			
			public boolean moveNext() throws Exception
			{
				while (state != 0)
				{
					switch (state) 
					{
					case 2:	if (moveNext_2()) return true; break;
					case 3:	if (moveNext_3()) return true; break;
 					}
				}
				return false;
			}

			private boolean moveNext_2() throws Exception {
				state = 0;				
				if (!(com.altova.functions.Core.equalOrGreater(com.mapforce.core.get_position_of_last_delimiter.eval(closure.var1_filepath, "\\", "/"), com.mapforce.core.get_position_of_last_delimiter.eval(closure.var1_filepath, ".", ".")))) {state = 3; return false; }
				current = "";
				pos++;
				return true;
			}
			private boolean moveNext_3() throws Exception {
				state = 0;				
				current = com.altova.functions.Core.substring(closure.var1_filepath, com.altova.CoreTypes.decimalToDouble(com.mapforce.core.get_position_of_last_delimiter.eval(closure.var1_filepath, ".", ".")), com.altova.CoreTypes.integerToDouble(com.altova.CoreTypes.longToInteger(com.altova.CoreTypes.intToLong(com.altova.functions.Core.stringLength(closure.var1_filepath)))));
				pos++;
				return true;
			}

			
			public void close()
			{
				try
				{
				}
				catch (Exception e)
				{
				}
			}
		}
				
	}



	// instances


	public static IEnumerable create(java.lang.String var1_filepath)
	{
		return new main(
			var1_filepath
			);

	}
	

	public static java.lang.String eval(java.lang.String var1_filepath) throws java.lang.Exception
	{

		com.altova.mapforce.IEnumerator e = create(var1_filepath).enumerator();
		if (e.moveNext())
		{
			java.lang.String result = ((java.lang.String)e.current());
			e.close();
			return result;
		}
		e.close();
		throw new com.altova.AltovaException("Expected a function result.");		
	
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy