Struct umm::grade::QueryGrader
source · pub struct QueryGrader {
req_name: String,
out_of: f64,
queries: Vec<Query>,
project: Project,
file: String,
constraint: QueryConstraint,
reason: String,
}
Expand description
A struct to represent a query grader.
Fields§
§req_name: String
The name of the requirement.
out_of: f64
The grade for the requirement.
queries: Vec<Query>
The queries to run.
project: Project
The input to run the queries on.
file: String
The file to run the query on.
constraint: QueryConstraint
The constraint of the query.
reason: String
The reason to share with the student.
Implementations§
source§impl QueryGrader
impl QueryGrader
sourcepub fn set_req_name(self, req_name: String) -> Self
pub fn set_req_name(self, req_name: String) -> Self
Sets the name of the requirement.
sourcepub fn set_out_of(self, out_of: f64) -> Self
pub fn set_out_of(self, out_of: f64) -> Self
Sets the “out of” grade for the requirement.
sourcepub fn set_project(self, project: Project) -> Self
pub fn set_project(self, project: Project) -> Self
Sets the project to run the query on.
sourcepub fn constraint(&self) -> QueryConstraint
pub fn constraint(&self) -> QueryConstraint
Gets the constraint of the query.
sourcepub fn must_match_at_least_once(self) -> Self
pub fn must_match_at_least_once(self) -> Self
Sets the constraint of the query to “must match at least once”.
sourcepub fn must_match_exactly_n_times(self, n: usize) -> Self
pub fn must_match_exactly_n_times(self, n: usize) -> Self
Sets the constraint of the query to “must match exactly n times”.
sourcepub fn must_not_match(self) -> Self
pub fn must_not_match(self) -> Self
Sets the constraint of the query to “must not match”.
sourcepub fn set_reason(self, reason: String) -> Self
pub fn set_reason(self, reason: String) -> Self
Sets the reason to share with the student.
sourcepub fn query(self, q: String) -> Result<Self, QueryError>
pub fn query(self, q: String) -> Result<Self, QueryError>
Adds a query to run. If no file has been selected, this will throw an error.
sourcepub fn query_script(self, q: String) -> Result<Self, Box<EvalAltResult>>
pub fn query_script(self, q: String) -> Result<Self, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
sourcepub fn capture(self, c: String) -> Result<Self, QueryError>
pub fn capture(self, c: String) -> Result<Self, QueryError>
Adds a capture to the last query. If no queries have been added, this will throw an error.
sourcepub fn capture_script(self, c: String) -> Result<Self, Box<EvalAltResult>>
pub fn capture_script(self, c: String) -> Result<Self, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
sourcepub fn filter(self, f: FnPtr) -> Result<Self, QueryError>
pub fn filter(self, f: FnPtr) -> Result<Self, QueryError>
Adds a capture to the last query. If no queries have been added, this will throw an error.
sourcepub fn filter_script(self, f: FnPtr) -> Result<Self, Box<EvalAltResult>>
pub fn filter_script(self, f: FnPtr) -> Result<Self, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
sourcepub fn method_body_with_name(self, method_name: String) -> Self
pub fn method_body_with_name(self, method_name: String) -> Self
Selects entire method body and returns
sourcepub fn method_body_with_return_type(self, return_type: String) -> Self
pub fn method_body_with_return_type(self, return_type: String) -> Self
Selects entire method body and returns
sourcepub fn main_method(self) -> Self
pub fn main_method(self) -> Self
Selects and returns the entire main method
sourcepub fn class_body_with_name(self, class_name: String) -> Self
pub fn class_body_with_name(self, class_name: String) -> Self
Selects entire class body with name
sourcepub fn local_variables(self) -> Self
pub fn local_variables(self) -> Self
Selects local variable declaration statements
sourcepub fn local_variables_with_name(self, name: String) -> Self
pub fn local_variables_with_name(self, name: String) -> Self
Selects local variable declaration statements with supplied name
sourcepub fn local_variables_with_type(self, type_name: String) -> Self
pub fn local_variables_with_type(self, type_name: String) -> Self
Selects local variable declaration statements with supplied type
sourcepub fn if_statements(self) -> Self
pub fn if_statements(self) -> Self
Selects if statements (entire, including else if and else)
sourcepub fn while_loops(self) -> Self
pub fn while_loops(self) -> Self
Selects while loops
sourcepub fn method_invocations(self) -> Self
pub fn method_invocations(self) -> Self
Selects method invocations
sourcepub fn method_invocations_with_name(self, name: String) -> Self
pub fn method_invocations_with_name(self, name: String) -> Self
Selects method invocations with supplied name
sourcepub fn method_invocations_with_arguments(self, name: String) -> Self
pub fn method_invocations_with_arguments(self, name: String) -> Self
Selects method invocations with supplied arguments
sourcepub fn method_invocations_with_object(self, name: String) -> Self
pub fn method_invocations_with_object(self, name: String) -> Self
Selects method invocations with supplied object
sourcepub fn run_query(&self) -> Result<Dynamic, QueryError>
pub fn run_query(&self) -> Result<Dynamic, QueryError>
Runs the queries, and returns the result. TODO: Make it so that it doesn’t parse a new piece of code, just filters out the irrelevant line ranges. This performs better but more importantly is more accurate.
sourcepub fn run_query_script(&self) -> Result<Dynamic, Box<EvalAltResult>>
pub fn run_query_script(&self) -> Result<Dynamic, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
sourcepub fn grade_by_query(self) -> Result<GradeResult>
pub fn grade_by_query(self) -> Result<GradeResult>
Grades the file according to the supplied queries, captures, and constraints.
sourcepub fn grade_by_query_script(self) -> Result<GradeResult, Box<EvalAltResult>>
pub fn grade_by_query_script(self) -> Result<GradeResult, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
Trait Implementations§
source§impl Clone for QueryGrader
impl Clone for QueryGrader
source§fn clone(&self) -> QueryGrader
fn clone(&self) -> QueryGrader
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl CustomType for QueryGrader
impl CustomType for QueryGrader
Allows registering custom types with Rhai.