Questions tagged [enumeration]

The process of enumerating values, for example from some collection.

Use for enumeration types.

1894 questions
0
votes
0 answers

Unexpected output from EnumWindows in C++

I wrote the following code one year ago to return a list of all the current windows #include #include using namespace std; BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { TCHAR buffer[512]; …
JackBoy
  • 61
  • 4
0
votes
1 answer

Pythonic way to write a series of non-cascading if statements

So I have this code I wrote to read from information from twitters REST API using tweepy and I'd like to collect a lot of information without exceeding the rate limit. This question is more of a conceptual one than tweepy-related. So far this is…
e1v1s
  • 365
  • 6
  • 18
0
votes
1 answer

What's the relationship between enumeration and class?

When the class Dog inherits from the class Animal, we say that 'Dog is an Animal'. When the class Dog has a property Name, we say that 'Dog has a Name'. When the class Dog has a method void Sleep(), we say that 'Dog can Sleep'. What do we say when a…
Happy Bird
  • 1,012
  • 2
  • 11
  • 29
0
votes
1 answer

Can an enumeration be a class? - C++ [enum class] [Theory]

My End Goal: Create the implementation of a hash-table from scratch. The twist, if the number of entries in a hash bucket is greater than 10 it is stored in Binary Search Tree, or else it is stored in a Linked List. In my knowledge the only way to…
Ayushya
  • 364
  • 1
  • 8
0
votes
4 answers

Flag empty collection or enumerate over members if collection is not empty (C#)

The obvious solution (to me) is the following: if (widgets.Count == 0) { //Handle empty collection } else { // Handle non-empty collection foreach (widget in widgets) { // Process widget } } This seems indentatious. I…
David Rogers
  • 4,010
  • 3
  • 29
  • 28
0
votes
4 answers

How to create a c# enumeration with more than one property

I want to create an enumeration like object but with an additional "property". For example I could have a day of the week enumeration: enum Day {Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; Now, let's say I have another…
under
  • 2,519
  • 1
  • 21
  • 40
0
votes
1 answer

Permutation o N elements in A boxes?

I'm trying to find all possible ways to arrange N elements in A boxes, where doesn't matter the order of the boxes and the order of the elements, but it does matter which elements are together at the same box. For example, the expected result for 3…
Rodrigo
  • 137
  • 1
  • 10
0
votes
1 answer

Passing enumerations by reference...garbage value returned to main

I'm building a validation function for a particular enumeration data type. The validation function returns 0 (false) or 1 (true) if string passed is valid. At the same time, if the string is valid, then the enumeration subType is then populated with…
Matthew McNaughton
  • 239
  • 1
  • 4
  • 16
0
votes
1 answer

Is it possible to reduce number of file numeration?

I wrote this in VB.NET, but I am comfortable with C# as well. I have a list of files that I want to find on a Windows file system. Based on the file name, I will need to look in a different directory. The list of files that I have is a list that…
Jayarikahs
  • 75
  • 11
0
votes
1 answer

Enumerating a custom array so I can use for-in

I knew how to do this but forgot again... Quite irritating, because I'm working on a class that contains a list of XML files, and now I just want to use a for-in loop to walk through all files in this list. This is the class I have right now: type …
Wim ten Brink
  • 25,901
  • 20
  • 83
  • 149
0
votes
1 answer

Count the number of comments in a C program

I've started studying C in the university. The professor gave us a task - to write a program that counts the number of comments in an another C program. We still haven't talked about operating with files. I found a similar solution - C Program to…
Alex
  • 485
  • 6
  • 18
0
votes
1 answer

How to set a reference to a property placeholder for an ESB mule enumerated type attribute

I am currently developping an ESB (3.7.0 CE) mule application and I am using Poll component with fixed-frequency-scheduler. I would like to externalize timeUnit scheduler's attribute as below:
0
votes
3 answers

JAVA nested hashtables with enum

i would like to have in my class a nested hastable to set the amount of ingredients. Please consider the following scenario. Scenario: One recipe has several ingredients: public class Ingredient { private static int id; String name; …
ePascoal
  • 2,362
  • 6
  • 26
  • 44
0
votes
0 answers

How do I use a switch statement to pass values from an enum to a method? Attempting to create a Java Poker Game

Enum Class public enum Suit { CLUB(0, "Clubs"), DIAMOND(1, "Diamonds"), HEART(2, "Hearts"), SPADE(3, "Spades");} private Suit(int sNum, String sName){ setsuitNumber(sNum); setsuitName(sName); public String…
Yoleaux
  • 49
  • 6
0
votes
2 answers

IEnumerable implementation only for Dictionary values

I have a class, let's say Player, with a name and some attributes: public class Players { public string PlayerName { get; set; } public IList Goals { get; set; } ... } I want to create a custom collection class, PlayerCollection,…
Phate01
  • 2,499
  • 2
  • 30
  • 55