AI Implementation for a Card Game
Hello; How can I implement a collection of three computer opponents in a client/server Java game? Thanks... ...
Hello; How can I implement a collection of three computer opponents in a client/server Java game? Thanks... ...
I'm working on an API which will read string values from a file and allow for type conversion. I also need it to provide a way of "mapping" given string values to a specific value of the desired type. That would look something like this: int val = myObject.getValue<int>("FieldName", { { "", 0 }, { "INF", int.MaxValue } }); The field...
I have a IEnumerable collection of objects. The objects have a field LastedUpdated which is a DateTime field. I want to filter the collection, given a timestamp that I have, to return the record in the collection with that timestamp and the "next record" in time (based on this field) because I then want to have some code do a "diff" be...
Hi Folks, Which collection interface is efficient to implement the singly and doubly linked list in java? code sample please? ...
Say I have an interface and some classes: public interface IPanel<ComponentType extends Component> { public void addComponents(Set<ComponentType> components); public ComponentType create(); } public class Button extends Component { } public class LocalizedButton extends Button { } public class ButtonsPanel implements IPanel<But...
Hi I'm trying to find products that are in two categories. I've found an example to get products that are in category1 OR category2. http://www.alphadigital.cl/blog/lang/en-us/magento-filter-by-multiple-categories.html I need products that are in category1 AND category2. The example in the blog is: class ModuleName_Catalog_Model_Resou...
Hello, this is more a theoretical question i asked myself. I remembered that BinarySearch of an ordered List(Collection in general) is faster than finding Rows with Datatable.Rows.Find or DataTable.FindByPK with a primary key value. Hence i fill a Datatable from Database in a shared constructor and immediately after that a List(of Int3...
i have what seems like a common problem / pattern. two collections of the same object. The object has a number of properties and some nested objects within it. Car has a property called id which is the unique identifier. I want to find the LINQ way to do a diff, which includes: Items in one collection and not the other (visa versa)...
In C#, how can I store a collection of values so if I want to retrieve a particular value later, I can do something like: myCollection["Area1"].AreaCount = 50; or count = myCollection["Area1"].AreaCount; Generic list? I'd like to store more than one property to a "key". Is a class the answer? ...
Hi all! I have a class with collection of enums: Class1.cs public enum Language { Serbian = 1, Croatian, Ukrainian, } public class Class1 { private IList<Language> m_languages = new List<Language>(); public virtual IList<Language> Languages { get { return m_languages; } set { m_languages = val...
Implementing Document-View pattern I faced the problem: standard generic collections and dictionaries (List<T>, HashSet<T> for example) don't provide events for modification (OnBeforeAdd, OnAfterAdd, OnRemove, Freeze/Unfreeze methods... ) I suppose events were not implemented for optimization purposes but I have to use and listen for s...
i have two collections of the same objects (same size list of course). items can be matched by an IEqualityComparer (matching on a unique property of the object). I want to generate a new list out of these existing lists that just show the field differences of each of the "same" items from each collection. I was thinking of doing some...
Hi, this is my first WCF service. I defined a response message that derives from a Dictionary like this: [CollectionDataContract(ItemName = "Product", KeyName = "ProductNumber", ValueName = "ProductName")] public class GetAvailableProductsResponse : Dictionary<string, string> { } When I try to run the following code in a service opera...
I am using Java and I am looking for String Collections (Sets and Lists) that are optimized in space and are fast. My strings are of fixed size: either 3 or 5 chars long. Please suggest to me if there are any collection libraries available that can be best suited to me. I was thinking of some dictionary based collections. Thanks. ...
i have the following code which doesnt seem to be working: Context: I have two lists of objects: * listOne has 100 records * listTwo has 70 records many of them have the same Id property (in both lists); var listOneOnlyItems = listOne.Except(listTwo, new ItemComparer ()); here is the comparer public class ItemComparer : IEqualit...
hi, I'm looking to create a HQL query that does the following: public Collection getCollection(Collection sons) { //return collection of fathers who's have all of the sons from the param } i'm a bit mixed up as to when to use query is HQL syntax (join etc..) and when to use "Criterias" Thanks in advance ...
I have the following class: class User { String username; @CollectionOfElements private Set<String> roles = new HashSet<String>(); [many more things here] } And I want to write a HQL query that retrieves the username and the roles for all the users. Query query = session.createQuery("select distinct u.username, u.roles from User u");...
Hi all. Learning GAE I`ve got some issue. I want to save contact list of my users in database. I use addUser() to add new user and it works. But when I refresh the page the list is empty (not null). In GAE "Datastore Viewer" the "list" field is null but in application it exists. @PersistenceCapable(identityType = IdentityType.APPLICATIO...
Hi all, Using NHibernate I'm trying to get obtain a list of B's where an IList property of B contains a specific instance of A. The following code should hopefully explain the situation more clearly: public void test() { A a1 = new A(); A a2 = new A(); B b1 = new B(); b1.As = new List<A> { a1 }; // ...database save...
I've written a Powershell script which will compare two databases and come up with a list of objects in one of the databases to remove. I put those items (as a customized object with a name and schema) into an array. In the next step of my script I iterate through the objects in the database and see if they match an object in my array. ...