Package utils
Class OTMUtils
- java.lang.Object
-
- utils.OTMUtils
-
public class OTMUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static doubleepsilonstatic longlane_group_counterstatic longvehicle_id_count
-
Constructor Summary
Constructors Constructor Description OTMUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanapproximately_equals(double x, double y)static <T> Stringcomma_format(Collection<T> x)static List<Double>csv2list(String csstr)static List<Long>csv2longlist(String csstr)static <T> booleanequals(Collection<T> A, Collection<T> B)static Stringformat_delim(double[] array, String delim)static <T> Stringformat_delim(T[] array, String delim)static longget_lanegroup_id()static longget_vehicle_id()static Floatget_waiting_time(double rate, StochasticProcess process)static booleangreater_than(double x, double y)static <T> HashSet<T>hashset(T x)static <T> List<T>init_list(int n, T val)static int[]int_hash_int(String str)static <T> Set<T>intersect(Collection<T> A, Collection<T> B)static intmin(int a, int b)static doublerandom_double(double min, double max)static intrandom_int(int min, int max)static doublerandom_zero_to_one()static ArrayList<Double>read_double_csv_file(File file)static int[][]read_int_table(String str)static LaneGroupSetread_lanegroups(String str, Map<Long,Link> links)static int[]read_lanes(String str, int full_lanes)static ArrayList<ArrayList<Double>>read_matrix_csv_file(File file)static voidreset_counters()static <T> Tsample_from_set(Set<T> set)static voidset_random_seed(long seed)static <T> Set<T>setminus(Collection<T> A, Collection<T> B)static doublesnap_to_grid(double x, double gridsize)static doublesum(Collection<Double> X)static <T> doublesum(Map<T,Double> X)static List<Double>times(List<Double> X, Double a)static List<Float>times(List<Float> X, Float a)static <T> Map<T,Double>times(Map<T,Double> X, Double a)static double[]toDoubleArray(List list)static float[]toFloatArray(List list)static long[]toLongArray(List list)static Stringwrite_int_table(int[][] table)
-
-
-
Method Detail
-
reset_counters
public static void reset_counters()
-
set_random_seed
public static void set_random_seed(long seed)
-
hashset
public static <T> HashSet<T> hashset(T x)
-
toDoubleArray
public static double[] toDoubleArray(List list)
-
toFloatArray
public static float[] toFloatArray(List list)
-
toLongArray
public static long[] toLongArray(List list)
-
init_list
public static <T> List<T> init_list(int n, T val)
-
min
public static int min(int a, int b)
-
approximately_equals
public static boolean approximately_equals(double x, double y)
-
greater_than
public static boolean greater_than(double x, double y)
-
sum
public static double sum(Collection<Double> X)
-
get_waiting_time
public static Float get_waiting_time(double rate, StochasticProcess process)
-
random_int
public static int random_int(int min, int max)
-
random_double
public static double random_double(double min, double max)
-
random_zero_to_one
public static double random_zero_to_one()
-
snap_to_grid
public static double snap_to_grid(double x, double gridsize)
-
sample_from_set
public static <T> T sample_from_set(Set<T> set)
-
intersect
public static <T> Set<T> intersect(Collection<T> A, Collection<T> B)
-
setminus
public static <T> Set<T> setminus(Collection<T> A, Collection<T> B)
-
equals
public static <T> boolean equals(Collection<T> A, Collection<T> B)
-
int_hash_int
public static int[] int_hash_int(String str)
-
comma_format
public static <T> String comma_format(Collection<T> x)
-
read_lanes
public static int[] read_lanes(String str, int full_lanes)
-
read_lanegroups
public static LaneGroupSet read_lanegroups(String str, Map<Long,Link> links) throws OTMException
- Throws:
OTMException
-
read_int_table
public static int[][] read_int_table(String str)
-
write_int_table
public static String write_int_table(int[][] table)
-
get_lanegroup_id
public static long get_lanegroup_id()
-
get_vehicle_id
public static long get_vehicle_id()
-
-