nitc :: CmdRandomEntities :: defaultinit
nitc $ CmdRandomEntities :: SELF
Type of this instance, automatically specialized in every classnitc $ CmdRandomEntities :: init_results
Always returnCmdSuccess
nitc :: CmdEntities :: _sorter
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: DocCommand :: cmd_filter
Return a new filter for that command execution.nitc :: CmdModelEntities :: defaultinit
nitc :: DocCommand :: defaultinit
nitc :: CmdEntities :: defaultinit
nitc :: CmdRandomEntities :: defaultinit
nitc :: CmdList :: defaultinit
core :: Object :: defaultinit
nitc :: DocCommand :: execute
nitc :: DocCommand :: filter=
ModelFilter to apply if anynitc :: DocCommand :: http_init
Init the command from an HTTPRequestcore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: CmdModelEntities :: kind=
Kind of mentities to be returned.core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: DocCommand :: parser_init
Initialize the command from the CommandParser datanitc :: CmdList :: print_list
nitc :: DocCommand :: to_json
Return a JSON Serializable representation ofself
results
# A command that returns a random list of mentities from a model
class CmdRandomEntities
super CmdModelEntities
# Always return `CmdSuccess`
redef fun init_results do
if results != null then return new CmdSuccess
var res = super
if not res isa CmdSuccess then return res
randomize
return res
end
# Randomize mentities order
fun randomize do
var results = self.results
if results == null then return
results.shuffle
end
end
src/doc/commands/commands_model.nit:527,1--546,3