/* PSPP - a program for statistical analysis.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Interaction is commutative. That means, that from a mathematical point of
view, the order of the variables is irrelevant. However, for display
- purposes, and for matching with an interaction's value the order is
+ purposes, and for matching with an interaction's value the order is
pertinent.
-
- Therefore, when using these functions, make sure the orders of variables
+
+ Therefore, when using these functions, make sure the orders of variables
and values match when appropriate.
*/
}
/*
- Do the variables in X->VARS constitute a
+ Do the variables in X->VARS constitute a
subset (proper or otherwise) of the variables in Y->VARS?
*/
bool
}
}
- /* If ALL the members of X were also found in Y, then this must be a subset */
+ /* If ALL the members of X were also found in Y, then this must be a subset */
if (n >= x->n_vars)
return true;
interaction_dump (const struct interaction *i)
{
int v = 0;
- printf ("%s", var_get_name (i->vars[v]));
- for (v = 1; v < i->n_vars; ++v)
+ if ( i->n_vars == 0)
{
- printf (" * %s", var_get_name (i->vars[v]));
+ printf ("(empty)\n");
+ return;
}
+ printf ("%s", var_get_name (i->vars[v]));
+ for (v = 1; v < i->n_vars; ++v)
+ printf (" * %s", var_get_name (i->vars[v]));
printf ("\n");
}
interaction_to_string (const struct interaction *iact, struct string *str)
{
int v = 0;
+ if ( iact->n_vars == 0)
+ return;
ds_put_cstr (str, var_to_string (iact->vars[v]));
for (v = 1; v < iact->n_vars; ++v)
{