Questions tagged [enumeration]

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

Use for enumeration types.

1894 questions
0
votes
4 answers

How to return Enum if matches with given String

I have Enum class as given below public enum AlgorithmEnum { SHA512("RSA", "SHA512", 1), SHA1("RSA", "SHA1", 1), SHA384("RSA", "SHA384", 1); private String keyAlgorithm; private String hashAlgorithm; private Integer key; …
rocky
  • 753
  • 2
  • 10
  • 26
0
votes
4 answers

ArrayList of Object as the Value of an EnumMap

I've been trying to do this for a little while and it's driving me crazy. I have an EnumMap where I have some enumeration as a key and an arraylist of a self-defined class as the value. So it looks something like this: private…
anujahooja
  • 30
  • 3
  • 6
0
votes
0 answers

How to enumerate a set of possible values used across services in python?

The title isn't exactly clear, I'm having trouble wording the problem correctly, but maybe an example will help. Let's say that I've implemented a job service in python. This is a server that accepts posted data that contains a job definition and…
John Allard
  • 3,564
  • 5
  • 23
  • 42
0
votes
1 answer

Python/SodaPY API returns unhashable type: dict

I have used a SodaPY client to download JSON data from the City of New York Open Gov initiative. SodaPY provides code and the following comments for using their client: # First 2000 results, returned as JSON from API / converted to Python list…
GPB
  • 2,395
  • 8
  • 26
  • 36
0
votes
1 answer

Enumerating, and printing lines in Python.

Okay, I am building a little program that will help single out Nmap results: #Python3.7.x # # # #report=input('Name of the file of Nmap Scan:\n') #target_ip=input('Which target is the report needed on?:\n') report = "ScanTest.txt" target_ip =…
Matt
  • 37
  • 4
0
votes
1 answer

Indexing fails once the Hashtable object assign to same Enumeration object

I have following code snippet in my legacy code. Here, It is iterating two Hashtables using Enumeration. Hashtable h4 = new Hashtable(); Hashtable h5 = new Hashtable(); for (int i=0 ; i < 3; i++) { h4.put (i, "" + i); …
nwGCham
  • 313
  • 1
  • 3
  • 16
0
votes
1 answer

How to update the dictionary from the user input and sort according to values using python?

I have dictionary below {0: {'STATE': 'AL', 'POPULATION': '151449859682', 'TOP_CITY': '1', 'RANK': '1'}, 1: {'STATE': 'NY', 'POPULATION': '8955557', 'TOP_CITY': '6', 'RANK': '2'}, 2: {'STATE': 'CA', 'POPULATION':…
user10508414
0
votes
2 answers

distincting xs:choices in xsd by using fixed values for element with enumeration type

Is it possible to distinct xs:choices in xsd by using fixed values? I have a simple type:
shutyaev
  • 247
  • 1
  • 5
  • 12
0
votes
1 answer

Populate treeview with - path enumeration

I'm trying to populate treeview with list od items. Item contain name and path: Here is the code: private void CreateTree(TreeNodeCollection nodeList, string path, string name) { TreeNode node = null; string f = string.Empty; …
Josef
  • 2,648
  • 5
  • 37
  • 73
0
votes
1 answer

What is the best way to assign object with enumeration type in entity framework?

I am fairly new to entity framework and I want to know what is the best approach to assign enumeration field to an object. I want to write: myObject.Status = Status.Active; Shall I do: myObject.Status = _context.myObjects.First(x=>x.Status.StatusId…
Marek
  • 2,419
  • 6
  • 34
  • 38
0
votes
2 answers

Is it possible to typcast TFormBorderStyle property to Integer and vise versa?

It looks like I could use the RTTI to convert the enumerated type of a TFormBorderStyle property to String ans store it in my IniFile, and vise versa. However, I assumed I could typecast it back and forth from integer as well, but it does not seem…
IElite
  • 1,818
  • 9
  • 39
  • 64
0
votes
1 answer

How to get relative string value from a Enum in C?

I have an Enum in C like the following: typedef enum { idle, backup, charge, } ENUM_LUMI_STATE; and I have the following function: ENUM_LUMI_STATE controllerGetState(void) { return idle; } I want to print it here: printf("the…
Sohrab
  • 1,348
  • 4
  • 13
  • 33
0
votes
2 answers

Iterating over list of tuples in elixir using Enum

I am trying to iterate over a list of tuples through Enum.map . coordinates = [{0,0},{1,0},{0,1}] newcoordinates = Enum.map(coordinates,fn({X,Y})->{X+1,Y+1}) This code is not valid . How can I do this ?
Arun Dhyani
  • 89
  • 1
  • 3
0
votes
1 answer

Ruby comparing if these 2 values DO NOT exist

What I'm trying to do In my Model, I want to select only the items that are NOT equal to (a or b) to. So I did this which works. # This works select { | item | item.attribute != a}.select {| item | item.attribute != b} Question This chaining…
alenm
  • 1,013
  • 3
  • 15
  • 34
0
votes
2 answers

Swift compile error: 'case' label can only appear inside a 'switch' statement?

I have a simple code like: enum Coin { case heads: 0 case tails } It throws an error on Line 2 that error: 'case' label can only appear inside a 'switch' statement How do I solve it?
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163