Skip to content

Commit cbfd63f

Browse files
committed
Purge trailing whitespace in bazaarbot/utils dir
1 parent a20ad8a commit cbfd63f

File tree

9 files changed

+117
-117
lines changed

9 files changed

+117
-117
lines changed

bazaarbot/utils/ArrayUtil.hx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package bazaarbot.utils;
44
* A set of functions for array manipulation. (Copied from HaxeFlixel)
55
*/
66
class ArrayUtil
7-
{
7+
{
88
/**
99
* Sets the length of an array.
10-
*
10+
*
1111
* @param array The array.
1212
* @param newLength The length you want the array to have.
1313
*/
@@ -30,12 +30,12 @@ class ArrayUtil
3030
#end
3131
}
3232
}
33-
33+
3434
/**
3535
* Safely removes an element from an array by swapping it with the last element and calling pop()
36-
* (won't do anything if the element is not in the array). This is a lot faster than regular splice(),
36+
* (won't do anything if the element is not in the array). This is a lot faster than regular splice(),
3737
* but it can only be used on arrays where order doesn't matter.
38-
*
38+
*
3939
* @param array The array to remove the element from
4040
* @param element The element to remove from the array
4141
* @return The array
@@ -50,13 +50,13 @@ class ArrayUtil
5050
}
5151
return array;
5252
}
53-
53+
5454
/**
5555
* Removes an element from an array by swapping it with the last element and calling pop().
5656
* This is a lot faster than regular splice(), but it can only be used on arrays where order doesn't matter.
57-
*
57+
*
5858
* IMPORTANT: always count down from length to zero if removing elements from whithin a loop
59-
*
59+
*
6060
* var i = array.length;
6161
* while (i-- > 0)
6262
* {
@@ -65,7 +65,7 @@ class ArrayUtil
6565
* ArrayUtil.swapAndPop(array, i);
6666
* }
6767
* }
68-
*
68+
*
6969
* @param array The array to remove the element from
7070
* @param index The index of the element to be removed from the array
7171
* @return The array
@@ -77,7 +77,7 @@ class ArrayUtil
7777
array.pop();
7878
return array;
7979
}
80-
80+
8181
/**
8282
* Clears an array structure, but leaves the object data untouched
8383
* Useful for cleaning up temporary references to data you want to preserve
@@ -110,7 +110,7 @@ class ArrayUtil
110110
}
111111
}
112112
}
113-
113+
114114
/**
115115
* Flattens 2D arrays into 1D arrays.
116116
* Example: [[1, 2], [3, 2], [1, 1]] -> [1, 2, 3, 2, 1, 1]
@@ -119,15 +119,15 @@ class ArrayUtil
119119
public static function flatten2DArray<T>(array:Array<Array<T>>):Array<T>
120120
{
121121
var result = [];
122-
122+
123123
for (innerArray in array)
124124
{
125125
result = result.concat(innerArray);
126126
}
127-
127+
128128
return result;
129129
}
130-
130+
131131
/**
132132
* Compares the contents with == to see if the two arrays are the same.
133133
* Also takes null arrays and the length of the arrays into account.
@@ -142,7 +142,7 @@ class ArrayUtil
142142
return false;
143143
if (array1.length != array2.length)
144144
return false;
145-
145+
146146
for (i in 0...array1.length)
147147
{
148148
if (array1[i] != array2[i])
@@ -152,7 +152,7 @@ class ArrayUtil
152152
}
153153
return true;
154154
}
155-
155+
156156
/**
157157
* Returns the last element of an array or null if the array is null / empty.
158158
*/
@@ -162,4 +162,4 @@ class ArrayUtil
162162
return null;
163163
return array[array.length - 1];
164164
}
165-
}
165+
}

bazaarbot/utils/DestroyUtil.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ class DestroyUtil
88
{
99
/**
1010
* Checks if an object is not null before calling destroy(), always returns null.
11-
*
11+
*
1212
* @param object An IDestroyable object that will be destroyed if it's not null.
1313
* @return null
1414
*/
1515
public static function destroy<T:IDestroyable>(object:Null<IDestroyable>):T
1616
{
1717
if (object != null)
1818
{
19-
object.destroy();
19+
object.destroy();
2020
}
2121
return null;
2222
}
23-
23+
2424
/**
2525
* Destroy every element of an array of IDestroyables
2626
*
@@ -41,4 +41,4 @@ class DestroyUtil
4141
interface IDestroyable
4242
{
4343
public function destroy():Void;
44-
}
44+
}

bazaarbot/utils/EconNoun.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ package bazaarbot.utils;
44
* @author larsiusprime
55
*/
66

7-
enum EconNoun
7+
enum EconNoun
88
{
99
Price;
1010
Ask;
1111
Bid;
1212
Trade;
1313
Profit;
14-
}
14+
}

bazaarbot/utils/History.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ class History
1111
public var bids (default, null):HistoryLog;
1212
public var trades(default, null):HistoryLog;
1313
public var profit(default, null):HistoryLog;
14-
15-
public function new()
14+
15+
public function new()
1616
{
1717
prices = new HistoryLog(Price);
1818
asks = new HistoryLog(Ask);
1919
bids = new HistoryLog(Bid);
2020
trades = new HistoryLog(Trade);
2121
profit = new HistoryLog(Profit);
2222
}
23-
23+
2424
public function register(good:String)
2525
{
2626
prices.register(good);
@@ -29,4 +29,4 @@ class History
2929
trades.register(good);
3030
profit.register(good);
3131
}
32-
}
32+
}

bazaarbot/utils/HistoryLog.hx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ class HistoryLog
99
{
1010
var type:EconNoun;
1111
var log:Map<String, Array<Float>>;
12-
13-
public function new(type:EconNoun)
12+
13+
public function new(type:EconNoun)
1414
{
1515
this.type = type;
1616
log = new Map<String, Array<Float>>();
1717
}
18-
18+
1919
/**
2020
* Add a new entry to this log
2121
* @param name
@@ -29,7 +29,7 @@ class HistoryLog
2929
list.push(amount);
3030
}
3131
}
32-
32+
3333
/**
3434
* Register a new category list in this log
3535
* @param name
@@ -41,7 +41,7 @@ class HistoryLog
4141
log.set(name, new Array<Float>());
4242
}
4343
}
44-
44+
4545
/**
4646
* Returns the average amount of the given category, looking backwards over a specified range
4747
* @param name the category of thing

bazaarbot/utils/MarketReport.hx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package bazaarbot.utils;
22

33
/**
44
* ...
5-
* @author
5+
* @author
66
*/
77
class MarketReport
88
{
@@ -11,17 +11,17 @@ class MarketReport
1111
public var strListGoodTrades:String = "";
1212
public var strListGoodAsks:String = "";
1313
public var strListGoodBids:String = "";
14-
14+
1515
public var strListAgent:String = "";
1616
public var strListAgentCount:String = "";
1717
public var strListAgentMoney:String = "";
1818
public var strListAgentProfit:String = "";
1919

2020
public var arrStrListInventory:Array<String>;
21-
22-
public function new()
21+
22+
public function new()
2323
{
24-
24+
2525
}
26-
27-
}
26+
27+
}

bazaarbot/utils/Quick.hx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Quick
1212
{
1313
return (a + b) / 2;
1414
}
15-
15+
1616
public static function listAvgf(list:Array<Float>):Float
1717
{
1818
var avg:Float = 0;
@@ -23,7 +23,7 @@ class Quick
2323
avg /= list.length;
2424
return avg;
2525
}
26-
26+
2727
public static inline function minArr(a:Array<Float>):Float
2828
{
2929
var min:Float = Math.POSITIVE_INFINITY;
@@ -32,7 +32,7 @@ class Quick
3232
}
3333
return min;
3434
}
35-
35+
3636
public static inline function maxArr(a:Array<Float>):Float
3737
{
3838
var max:Float = Math.NEGATIVE_INFINITY;
@@ -41,7 +41,7 @@ class Quick
4141
}
4242
return max;
4343
}
44-
44+
4545
/**
4646
* Turns a number into a string with the specified number of decimal points
4747
* @param num
@@ -90,7 +90,7 @@ class Quick
9090
}
9191
return str;
9292
}
93-
93+
9494
public static inline function positionInRange(value:Float, min:Float, max:Float, clamp:Bool = true):Float
9595
{
9696
value -= min;
@@ -103,12 +103,12 @@ class Quick
103103
}
104104
return value;
105105
}
106-
106+
107107
public static inline function randomInteger(min:Int, max:Int):Int
108108
{
109109
return Std.int(Math.random() * cast(1 + max - min, Float)) + min;
110110
}
111-
111+
112112
public static inline function randomRange(a:Float, b:Float):Float
113113
{
114114
var r:Float = Math.random();
@@ -117,7 +117,7 @@ class Quick
117117
var range:Float = max - min;
118118
return r * range + min;
119119
}
120-
120+
121121
public static function shuffle(list:Array<Offer>):Array<Offer>
122122
{
123123
/*
@@ -139,34 +139,34 @@ class Quick
139139
}
140140
return list;
141141
}
142-
142+
143143
public static function sortAgentAlpha(a:BasicAgent, b:BasicAgent):Int
144144
{
145145
if (a.className < b.className) return -1;
146146
if (a.className > b.className) return 1;
147147
return 0;
148148
}
149-
149+
150150
public static function sortAgentId(a:BasicAgent, b:BasicAgent):Int
151151
{
152152
if (a.id < b.id) return -1;
153153
if (a.id > b.id) return 1;
154154
return 0;
155155
}
156-
156+
157157
public static function sortDecreasingPrice(a:Offer, b:Offer):Int
158158
{
159159
//Decreasing means: highest first
160160
if (a.unit_price < b.unit_price) return 1;
161161
if (a.unit_price > b.unit_price) return -1;
162162
return 0;
163163
}
164-
164+
165165
public static function sortIncreasingPrice(a:Offer, b:Offer):Int
166166
{
167167
//Increasing means: lowest first
168168
if (a.unit_price > b.unit_price) return 1;
169169
if (a.unit_price < b.unit_price) return -1;
170170
return 0;
171171
}
172-
}
172+
}

0 commit comments

Comments
 (0)