Skip to main content
Glama
Calculator.java950 B
// Java test file public class Calculator { private double result; public Calculator() { this.result = 0.0; } public static double calculateSum(double a, double b) { return a + b; } public Calculator add(double value) { this.result += value; return this; } public Calculator multiply(double value) { this.result *= value; return this; } public double getResult() { return this.result; } } interface MathOperations { double calculate(double a, double b); } enum Operation { ADD, SUBTRACT, MULTIPLY, DIVIDE; public double apply(double a, double b) { switch (this) { case ADD: return a + b; case SUBTRACT: return a - b; case MULTIPLY: return a * b; case DIVIDE: return a / b; default: throw new IllegalArgumentException(); } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FarhanAliRaza/claude-context-local'

If you have feedback or need assistance with the MCP directory API, please join our Discord server