Exemplo n.º 1
0
    public override bool Add(Expression e)
    {
        bool changed = false;

        if (e == null)
        {
            if (hasBlank)
            {
                return(false);
            }
            hasBlank = true;
            return(true);
        }

        String head    = e.headString;
        int    numArgs = e.GetNumArgs();

        if (!entriesByHeadString.ContainsKey(head))
        {
            entriesByHeadString.Add(head, new PrefixModel[numArgs]);
            changed = true;
        }

        PrefixModel[] argTrees = entriesByHeadString[head];

        for (int i = 0; i < numArgs; i++)
        {
            if (argTrees[i] == null)
            {
                argTrees[i] = new PrefixModel();
            }
            changed = argTrees[i].Add(e.GetArg(i)) || changed;
        }


        return(changed);
    }
Exemplo n.º 2
0
 public static string PrintPrefixModel(PrefixModel model)
 => PrintPrefixModelWithPadding(model, 0);
Exemplo n.º 3
0
 private static string PrintPrefixModelWithPadding(PrefixModel model, int padding)
 => new StringBuilder()
 .AppendLine($"{new string(' ', padding)}Prefix: {model.Prefix}")
 .AppendLine($"{new string(' ', padding)}Name: {model.Name}")
 .AppendLine($"{new string(' ', padding)}Description: {model.Description}")
 .ToString();
Exemplo n.º 4
0
 public static bool Save(IServerAuthentication restClientAuthenticator, PrefixModel model)
 {
     return(ApiClientGenericObject <PrefixModel> .Save(restClientAuthenticator, ControllerName, model));
 }