@Test public void parent_map_constructor() { SimpleScope parent_scope = new SimpleScope(singletonMap("foo", Type.GROUP)); SimpleScope scope = new SimpleScope(parent_scope, singletonMap("bar", Type.VALUE)); assertFalse(scope.getIdentifiers().isEmpty()); assertEquals(Optional.of(Type.GROUP), scope.getIdentifier("foo")); assertEquals(Optional.of(Type.VALUE), scope.getIdentifier("bar")); assertTrue(scope.isIdentifier("foo")); assertTrue(scope.isIdentifier("foo", Type.GROUP)); assertFalse(scope.isIdentifier("foo", Type.METRIC)); assertFalse(scope.isIdentifier("foo", Type.VALUE)); assertTrue(scope.isIdentifier("bar")); assertFalse(scope.isIdentifier("bar", Type.GROUP)); assertFalse(scope.isIdentifier("bar", Type.METRIC)); assertTrue(scope.isIdentifier("bar", Type.VALUE)); assertEquals(Valid.VALID_IDENTIFIER, scope.isValidIdentifier("foo", Type.GROUP)); assertEquals(Valid.DIFFERENT_IDENTIFIER, scope.isValidIdentifier("foo", Type.METRIC)); assertEquals(Valid.DIFFERENT_IDENTIFIER, scope.isValidIdentifier("foo", Type.VALUE)); assertEquals(Valid.DIFFERENT_IDENTIFIER, scope.isValidIdentifier("bar", Type.GROUP)); assertEquals(Valid.DIFFERENT_IDENTIFIER, scope.isValidIdentifier("bar", Type.METRIC)); assertEquals(Valid.VALID_IDENTIFIER, scope.isValidIdentifier("bar", Type.VALUE)); }
@Override public Map<String, Type> getIdentifiers() { return identifiers_; }
SimpleScope implements Scope { @Override public Map<String, Type> getIdentifiers() { return identifiers_; } }
SimpleScope implements Scope { @Override public Map<String, Type> getIdentifiers() { return identifiers_; } SimpleScope();  SimpleScope(Scope parent);  SimpleScope(Scope parent, Map<String, Type> identifiers);  SimpleScope(Map<String, Type> identifiers); }
SimpleScope implements Scope { @Override public Map<String, Type> getIdentifiers() { return identifiers_; } SimpleScope();  SimpleScope(Scope parent);  SimpleScope(Scope parent, Map<String, Type> identifiers);  SimpleScope(Map<String, Type> identifiers); @Override Map<String, Type> getIdentifiers(); }
SimpleScope implements Scope { @Override public Map<String, Type> getIdentifiers() { return identifiers_; } SimpleScope();  SimpleScope(Scope parent);  SimpleScope(Scope parent, Map<String, Type> identifiers);  SimpleScope(Map<String, Type> identifiers); @Override Map<String, Type> getIdentifiers();  }