Subversion Repository Public Repository

CommodityUtility

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
´╗┐using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;

namespace CommodityUtility
{
    public static class SharedMethods
    {
        
        //public static ArrayList GetIslandPair(string island1, string island2)
        //{
        //    ArrayList islands = new ArrayList();
        //    string firstIsland = island1;
        //    string secondIsland = island2;

        //    // Which island comes first alphabetically?
        //    int result = firstIsland.CompareTo(secondIsland);

        //    // If result < 0, the first island is already first alphabetically.
        //    // If result = 0, the islands are the same so it doesn't matter which is first
        //    // If result > 0, the second island is first alphabetically.  Swap them.
        //    if (result > 0)
        //    {
        //        string temp = firstIsland;
        //        firstIsland = secondIsland;
        //        secondIsland = temp;
        //    }

        //    islands.Add(firstIsland);
        //    islands.Add(secondIsland);

        //    return islands;
        //}

        //public static int GetDistance(string island1, string island2)
        //{
        //    ArrayList islands = GetIslandPair(island1, island2);

        //    IslandDataSet data = new IslandDataSet();
        //    IslandDataSetTableAdapters.IslandPairsTableAdapter adapter = new CommodityUtility.IslandDataSetTableAdapters.IslandPairsTableAdapter();
        //    adapter.FillBy(data.IslandPairs, islands[0].ToString(), islands[1].ToString());
        //    return Convert.ToInt32(data.IslandPairs.Rows[0].Field<int>("distance"));
        //}

        //public static int GetEstimatedCost(int distance, int distanceMod)
        //{
        //    return (distance * distanceMod) - (10 * distance);
        //}

        //public static int GetDistanceModifier()
        //{
        //    IslandDataSet data = new IslandDataSet();
        //    IslandDataSetTableAdapters.DefaultsTableAdapter adapter = new CommodityUtility.IslandDataSetTableAdapters.DefaultsTableAdapter();
        //    adapter.Fill(data.Defaults);
        //    return Convert.ToInt32(data.Defaults.Rows[0].Field<int>("distanceMod"));
        //}

        //public static int GetEstimatedCost(string island1, string island2)
        //{
        //    int distanceMod = GetDistanceModifier();
        //    int distance = GetDistance(island1, island2);
        //    return GetEstimatedCost(distance, distanceMod);
        //}
    }
}

Commits for CommodityUtility/SharedMethods.cs

Diff revisions: vs.
Revision Author Commited Message
3 wysperia picture wysperia Thu 14 Jul, 2011 20:21:16 +0000

Version 1.0