The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
15 | indicated below, the Content is provided to you under the terms and conditions of the
16 | Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
17 | at http://www.eclipse.org/legal/epl-v10.html.
18 | For purposes of the EPL, "Program" will mean the Content.
19 |
20 |
If you did not receive this Content directly from the Eclipse Foundation, the Content is
21 | being redistributed by another party ("Redistributor") and different terms and conditions may
22 | apply to your use of any object code in the Content. Check the Redistributor's license that was
23 | provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
24 | indicated below, the terms and conditions of the EPL still apply to any source code in the Content
25 | and such source code may be obtained at http://www.eclipse.org.
26 |
27 |
28 |
--------------------------------------------------------------------------------
/pdb.values/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .,\
5 | about.html
6 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IBool.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Jurgen Vinju (jurgen@vinju.org) - initial API and implementation
10 | *******************************************************************************/
11 | package org.eclipse.imp.pdb.facts;
12 |
13 | public interface IBool extends IValue {
14 | boolean getValue();
15 | String getStringRepresentation();
16 | IBool and(IBool other);
17 | IBool or(IBool other);
18 | IBool xor(IBool other);
19 | IBool not();
20 | IBool implies(IBool other);
21 | IBool equivalent(IBool other);
22 | }
23 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IExternalValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Jurgen Vinju - initial API and implementation
10 |
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts;
13 |
14 | import org.eclipse.imp.pdb.facts.type.ExternalType;
15 |
16 | /**
17 | * IExternalValue, together with {@link ExternalType} offer a limited form of extensibility
18 | * to the PDB's value and type system. The IExternalValue interface is used to tag extensions,
19 | * such as 'function values' that are not part of the PDB fact exchange and manipulation
20 | * interfaces but do need to integrate with them.
21 | *
22 | * Note that features such as (de)serialization are not supported for external values. However,
23 | * such generic features will provide a non-failing default such as (quietly) not serializing
24 | * the value at all. This is to obtain robustness.
25 | *
26 | * Note that implementations of IExternalValues are obliged to have a type that subclasses
27 | * ExternalType.
28 | *
29 | * Note that NORMAL USE OF THE PDB DOES NOT REQUIRE IMPLEMENTING THIS INTERFACE
30 | */
31 | public interface IExternalValue extends IValue {
32 | // this is a marker interface
33 | }
34 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IListAlgebra.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts;
2 |
3 | public interface IListAlgebra> {
4 |
5 | T concat (T collection);
6 | T intersect (T collection);
7 | T subtract (T collection);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IListRelation.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts;
2 |
3 | public interface IListRelation> extends IRelationalAlgebra> {
4 |
5 | T asList();
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IMapWriter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 CWI.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Robert Fuhrer (rfuhrer@watson.ibm.com) - initial API and implementation
10 |
11 | *******************************************************************************/
12 |
13 | package org.eclipse.imp.pdb.facts;
14 |
15 | import java.util.Map;
16 |
17 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
18 |
19 |
20 | public interface IMapWriter extends IWriter {
21 | void put(IValue key, IValue value) throws FactTypeUseException ;
22 | void putAll(IMap map) throws FactTypeUseException;
23 | void putAll(Map map) throws FactTypeUseException;
24 | IMap done();
25 | }
26 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IRelationalAlgebra.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts;
2 |
3 | /*
4 | * Desired:
5 | * public interface IRelationalAlgebra>
6 | */
7 | public interface IRelationalAlgebra> {
8 |
9 | R compose(A1 other);
10 | R closure();
11 | R closureStar();
12 |
13 | int arity();
14 | R project(int... fields);
15 |
16 | @Deprecated
17 | R projectByFieldNames(String... fields);
18 |
19 | R carrier();
20 | R domain();
21 | R range();
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/ISetAlgebra.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts;
2 |
3 | public interface ISetAlgebra> {
4 |
5 | T union (T collection);
6 | T intersect (T collection);
7 | T subtract (T collection);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/ISetRelation.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts;
2 |
3 | public interface ISetRelation> extends IRelationalAlgebra> {
4 |
5 | T asSet();
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/ISetWriter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2007 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Robert Fuhrer (rfuhrer@watson.ibm.com) - initial API and implementation
10 |
11 | *******************************************************************************/
12 |
13 | package org.eclipse.imp.pdb.facts;
14 |
15 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
16 |
17 |
18 | public interface ISetWriter extends IWriter {
19 | void insert(IValue... v) throws FactTypeUseException ;
20 | void insertAll(Iterable extends IValue> collection) throws FactTypeUseException;
21 | ISet done();
22 | }
23 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/ITuple.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2007 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Robert Fuhrer (rfuhrer@watson.ibm.com) - initial API and implementation
10 |
11 | *******************************************************************************/
12 |
13 | package org.eclipse.imp.pdb.facts;
14 |
15 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
16 |
17 | public abstract interface ITuple extends Iterable, IValue {
18 | public IValue get(int i) throws IndexOutOfBoundsException;
19 |
20 | @Deprecated
21 | public IValue get(String label) throws FactTypeUseException;
22 |
23 | public ITuple set(int i, IValue arg) throws IndexOutOfBoundsException;
24 |
25 | @Deprecated
26 | public ITuple set(String label, IValue arg) throws FactTypeUseException;
27 |
28 | public int arity();
29 |
30 | public boolean equals(Object o);
31 |
32 | public IValue select(int... fields) throws IndexOutOfBoundsException;
33 |
34 | @Deprecated
35 | public IValue selectByFieldNames(String... fields) throws FactTypeUseException;
36 | }
37 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/IWriter.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts;
2 |
3 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
4 |
5 | public interface IWriter {
6 | void insert(IValue... value) throws FactTypeUseException;
7 | void insertAll(Iterable extends IValue> collection) throws FactTypeUseException;
8 | public IValue done();
9 | }
10 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/EmptyIdentifierException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class EmptyIdentifierException extends FactTypeDeclarationException {
4 | private static final long serialVersionUID = -7032740671919237233L;
5 |
6 | public EmptyIdentifierException() {
7 | super("An identifier can not be empty or null");
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/FactParseError.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class FactParseError extends RuntimeException {
4 | private static final long serialVersionUID = 8208492896666238438L;
5 | private int offset = -1;
6 |
7 | public FactParseError(String message, Throwable cause) {
8 | super(message, cause);
9 | }
10 |
11 | public FactParseError(String message, int offset) {
12 | super(message);
13 | this.offset = offset;
14 | }
15 |
16 | public FactParseError(String message, int offset, Throwable cause) {
17 | super(message + " at offset " + offset, cause);
18 | this.offset = offset;
19 | }
20 |
21 | public boolean hasCause() {
22 | return getCause() != null;
23 | }
24 |
25 |
26 | public boolean hasOffset() {
27 | return offset != -1;
28 | }
29 | public int getOffset() {
30 | return offset;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/FactTypeDeclarationException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2007 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Robert Fuhrer (rfuhrer@watson.ibm.com) - initial API and implementation
10 |
11 | *******************************************************************************/
12 |
13 | package org.eclipse.imp.pdb.facts.exceptions;
14 |
15 | public abstract class FactTypeDeclarationException extends RuntimeException {
16 | private static final long serialVersionUID = -2991169068626385361L;
17 |
18 | public FactTypeDeclarationException(String message) {
19 | super(message);
20 | }
21 |
22 | public FactTypeDeclarationException(String message, Throwable cause) {
23 | super(message, cause);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/FactTypeRedeclaredException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class FactTypeRedeclaredException extends FactTypeDeclarationException {
6 | private static final long serialVersionUID = 9191150588452685289L;
7 | private String name;
8 | private Type earlier;
9 |
10 | public FactTypeRedeclaredException(String name, Type earlier) {
11 | super(name + " was declared earlier as " + earlier);
12 | this.name = name;
13 | this.earlier = earlier;
14 | }
15 |
16 | public String getName() {
17 | return name;
18 | }
19 |
20 | public Type declaredEarlier() {
21 | return earlier;
22 | }
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/FactTypeUseException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2007 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Robert Fuhrer (rfuhrer@watson.ibm.com) - initial API and implementation
10 |
11 | *******************************************************************************/
12 |
13 | package org.eclipse.imp.pdb.facts.exceptions;
14 |
15 | public abstract class FactTypeUseException extends RuntimeException {
16 | private static final long serialVersionUID= 2135696551442574010L;
17 |
18 | public FactTypeUseException(String message) {
19 | super(message);
20 | }
21 |
22 | public FactTypeUseException(String reason, Throwable cause) {
23 | super(reason, cause);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/FieldLabelMismatchException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class FieldLabelMismatchException extends FactTypeDeclarationException {
4 | private static final long serialVersionUID = 3510697170437859049L;
5 | private int fields;
6 | private int labels;
7 |
8 | public FieldLabelMismatchException(int fields, int labels) {
9 | super("Expected " + fields + " field labels, but got " + labels);
10 | this.fields = fields;
11 | this.labels = labels;
12 | }
13 |
14 | public int getFields() {
15 | return fields;
16 | }
17 |
18 | public int getLabels() {
19 | return labels;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalAnnotationDeclaration.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class IllegalAnnotationDeclaration extends FactTypeDeclarationException {
6 | private static final long serialVersionUID = 3150260732700154774L;
7 | private Type onType;
8 |
9 | public IllegalAnnotationDeclaration(Type onType) {
10 | super("Can not declare annotations on " + onType);
11 | this.onType = onType;
12 | }
13 |
14 | public Type getType() {
15 | return onType;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalConstructorApplicationException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class IllegalConstructorApplicationException extends FactTypeUseException {
6 | private static final long serialVersionUID = -1412303012184333060L;
7 |
8 | public IllegalConstructorApplicationException(Type constructorType, Type arguments) {
9 | super("Constructor " + constructorType + " is not applicable to " + arguments);
10 | }
11 |
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalFieldNameException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class IllegalFieldNameException extends FactTypeDeclarationException {
4 | private static final long serialVersionUID = -2480224409679761754L;
5 | private int pos;
6 | private Object elem;
7 |
8 | public IllegalFieldNameException(int pos, Object elem, ClassCastException cause) {
9 | super("Expected a field name at position " + pos + ", but got something different", cause);
10 | this.pos = pos;
11 | this.elem = elem;
12 | }
13 |
14 | public Object getElement() {
15 | return elem;
16 | }
17 |
18 | public int getPos() {
19 | return pos;
20 | }
21 |
22 | public synchronized ClassCastException getCause() {
23 | return (ClassCastException) super.getCause();
24 | }
25 |
26 | public IllegalFieldNameException(String message, Throwable cause) {
27 | super(message, cause);
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalFieldTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class IllegalFieldTypeException extends FactTypeDeclarationException {
4 | private static final long serialVersionUID = -8845629423612702596L;
5 | private int pos;
6 | private Object elem;
7 |
8 | public IllegalFieldTypeException(int pos, Object elem, ClassCastException cause) {
9 | super("Expected a field type at position " + pos + ", but got something different", cause);
10 | this.pos = pos;
11 | this.elem = elem;
12 | }
13 |
14 | public Object getElement() {
15 | return elem;
16 | }
17 |
18 | public int getPos() {
19 | return pos;
20 | }
21 |
22 | public synchronized ClassCastException getCause() {
23 | return (ClassCastException) super.getCause();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalIdentifierException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class IllegalIdentifierException extends FactTypeDeclarationException {
4 | private static final long serialVersionUID = 7380196205269771711L;
5 | private String id;
6 |
7 | public IllegalIdentifierException(String id) {
8 | super(id + " is not a valid identifier");
9 | this.id = id;
10 | }
11 |
12 | public String getIdentifier() {
13 | return id;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalInstantiatedAbstractDataTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class IllegalInstantiatedAbstractDataTypeException extends
6 | FactTypeDeclarationException {
7 | private static final long serialVersionUID = -7171289358305194254L;
8 |
9 | public IllegalInstantiatedAbstractDataTypeException(Type adt) {
10 | super("should not declare instances of type-parametrized abstract data-types (" + adt + ")");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalKeywordParameterDeclarationException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class IllegalKeywordParameterDeclarationException extends FactTypeUseException {
6 | private static final long serialVersionUID = -1073149631907760703L;
7 |
8 | public IllegalKeywordParameterDeclarationException(Type type) {
9 | super("Keyword parameters can not be declared on " + type);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/IllegalOperationException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class IllegalOperationException extends FactTypeUseException {
6 | private static final long serialVersionUID = 546504861606007094L;
7 |
8 | private Type lhs;
9 | private Type rhs;
10 | private String op;
11 |
12 | public IllegalOperationException(String op, Type lhs) {
13 | super("Operation " + op + " not allowed on " + lhs);
14 | this.lhs = lhs;
15 | }
16 |
17 | public IllegalOperationException(String op, Type lhs, Type rhs) {
18 | super("Operation " +op + " not allowed on " + lhs + " and " + rhs);
19 | this.op = op;
20 | this.lhs = lhs;
21 | this.rhs = rhs;
22 | }
23 |
24 | public Type getLhs() {
25 | return lhs;
26 | }
27 |
28 | public Type getRhs() {
29 | return rhs;
30 | }
31 |
32 | public String getOperation() {
33 | return op;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/InvalidDateTimeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class InvalidDateTimeException extends FactTypeUseException {
4 |
5 | private static final long serialVersionUID = 5634976179346912971L;
6 |
7 | public InvalidDateTimeException(String message) {
8 | super(message);
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/NullTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | public class NullTypeException extends FactTypeUseException {
4 | private static final long serialVersionUID = -4201840676263159311L;
5 |
6 | public NullTypeException() {
7 | super("A null reference as a type");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/OverloadingNotSupportedException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class OverloadingNotSupportedException extends FactTypeUseException {
6 | private static final long serialVersionUID = 5645367130014687132L;
7 |
8 | public OverloadingNotSupportedException(String constructorId) {
9 | super("Overloading is not supported (" + constructorId + ")");
10 | }
11 |
12 | public OverloadingNotSupportedException(Type adt, String constructorId) {
13 | super("Overloading is not supported (" + adt + "." + constructorId + ")");
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/RedeclaredAnnotationException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class RedeclaredAnnotationException extends FactTypeDeclarationException {
6 | private static final long serialVersionUID = -2118606173620347920L;
7 | private String label;
8 | private Type earlier;
9 |
10 | public RedeclaredAnnotationException(String label, Type earlier) {
11 | super("Annotation " + label + " was declared earlier as " + earlier);
12 | this.label = label;
13 | this.earlier = earlier;
14 | }
15 |
16 | public String getLabel() {
17 | return label;
18 | }
19 |
20 | public Type getEarlierType() {
21 | return earlier;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/RedeclaredConstructorException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class RedeclaredConstructorException extends
6 | FactTypeDeclarationException {
7 | private static final long serialVersionUID = 8330548728032865311L;
8 | private String name;
9 | private Type firstArgs;
10 | private Type secondArgs;
11 |
12 | public RedeclaredConstructorException(String name, Type firstArgs, Type secondArgs) {
13 | super("Constructor " + name + " overloaded with comparable argument types: " + firstArgs + " and " + secondArgs);
14 | this.name = name;
15 | this.firstArgs = firstArgs;
16 | this.secondArgs = secondArgs;
17 | }
18 |
19 | public String getName() {
20 | return name;
21 | }
22 |
23 | public Type getFirstArgs() {
24 | return firstArgs;
25 | }
26 |
27 | public Type getSecondArgs() {
28 | return secondArgs;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/RedeclaredFieldNameException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class RedeclaredFieldNameException extends
6 | FactTypeDeclarationException {
7 | private static final long serialVersionUID = -4401062690006714904L;
8 | private String label;
9 | private Type one;
10 | private Type two;
11 | private Type tupleType;
12 |
13 | public RedeclaredFieldNameException(String label, Type one, Type two, Type tupleType) {
14 | super("The field name " + label + " is illegally used for both " + one + " and " + two + " in type " + tupleType);
15 | this.label = label;
16 | this.one = one;
17 | this.two = two;
18 | this.tupleType = tupleType;
19 | }
20 |
21 | public String getFieldName() {
22 | return label;
23 | }
24 |
25 | public Type getFirstType() {
26 | return one;
27 | }
28 |
29 | public Type getSecondType() {
30 | return two;
31 | }
32 |
33 | public Type getTupleType() {
34 | return tupleType;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/RedeclaredKeywordParameterException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class RedeclaredKeywordParameterException extends FactTypeDeclarationException {
6 | private static final long serialVersionUID = -2118606173620347920L;
7 | private String label;
8 | private Type earlier;
9 |
10 | public RedeclaredKeywordParameterException(String label, Type earlier) {
11 | super("Keyword parameter " + label + " was declared earlier as " + earlier);
12 | this.label = label;
13 | this.earlier = earlier;
14 | }
15 |
16 | public String getLabel() {
17 | return label;
18 | }
19 |
20 | public Type getEarlierType() {
21 | return earlier;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UndeclaredAbstractDataTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UndeclaredAbstractDataTypeException extends
6 | FactTypeDeclarationException {
7 | private static final long serialVersionUID = 2192451595458909479L;
8 |
9 | public UndeclaredAbstractDataTypeException(Type adt) {
10 | super(adt + " is not registered");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UndeclaredAnnotationException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UndeclaredAnnotationException extends FactTypeUseException {
6 | private static final long serialVersionUID = 8997399464492627705L;
7 | private Type type;
8 | private String label;
9 |
10 | public UndeclaredAnnotationException(Type type, String label) {
11 | super(type + " does not have an annotation with label " + label + " declared for it");
12 | this.type = type;
13 | this.label = label;
14 | }
15 |
16 | public Type getType() {
17 | return type;
18 | }
19 |
20 | public String getLabel() {
21 | return label;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UndeclaredConstructorException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UndeclaredConstructorException extends FactTypeUseException {
6 | private static final long serialVersionUID = -6301806947030330971L;
7 | private Type adt;
8 | private String unknownName;
9 | private Type arguments;
10 |
11 | public UndeclaredConstructorException(Type adt, Type argTypes) {
12 | super(adt + " does not have a constructor to wrap these argument types: " + argTypes);
13 | this.adt = adt;
14 | this.arguments = argTypes;
15 | }
16 |
17 | public UndeclaredConstructorException(String constructorName) {
18 | super("A constructor with name " + constructorName + " was never declared");
19 | this.unknownName = constructorName;
20 | }
21 |
22 | public UndeclaredConstructorException(String constructorName, Type arguments) {
23 | super("A constructor with name " + constructorName + " and argument types " + arguments + " was never declared");
24 | this.unknownName = constructorName;
25 | this.arguments = arguments;
26 | }
27 |
28 | public String getName() {
29 | return unknownName;
30 | }
31 |
32 | public boolean hasArgumentTypes() {
33 | return arguments != null;
34 | }
35 |
36 | public Type getArgumentTypes() {
37 | return arguments;
38 | }
39 |
40 | public Type getADT() {
41 | return adt;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UndeclaredFieldException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UndeclaredFieldException extends FactTypeUseException {
6 | private static final long serialVersionUID = 8997399464492627705L;
7 | private Type type;
8 | private String label;
9 |
10 | public UndeclaredFieldException(Type type, String label) {
11 | super(type + " does not have a field with label " + label + " declared for it");
12 | this.type = type;
13 | this.label = label;
14 | }
15 |
16 | public Type getType() {
17 | return type;
18 | }
19 |
20 | public String getLabel() {
21 | return label;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedAnnotationTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedAnnotationTypeException extends UnexpectedTypeException {
6 | private static final long serialVersionUID = -4865168232421987847L;
7 |
8 | public UnexpectedAnnotationTypeException(Type expected, Type got) {
9 | super(expected, got);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedChildTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedChildTypeException extends UnexpectedTypeException {
6 | private static final long serialVersionUID = -1848764011952028440L;
7 |
8 | public UnexpectedChildTypeException(Type expected, Type got) {
9 | super(expected, got);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedConstructorTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedConstructorTypeException extends UnexpectedTypeException {
6 | private static final long serialVersionUID = -6198133177142765746L;
7 |
8 | public UnexpectedConstructorTypeException(Type expected, Type got) {
9 | super(expected, got);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedElementTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedElementTypeException extends UnexpectedTypeException {
6 | private static final long serialVersionUID = 8098855538349829776L;
7 |
8 | public UnexpectedElementTypeException(Type expected, Type got) {
9 | super(expected, got);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedMapKeyTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedMapKeyTypeException extends UnexpectedTypeException {
6 | private static final long serialVersionUID = -914783577719833513L;
7 |
8 | public UnexpectedMapKeyTypeException(Type expected, Type got) {
9 | super(expected, got);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedMapValueTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedMapValueTypeException extends UnexpectedTypeException {
6 | private static final long serialVersionUID = -5746761186412867857L;
7 |
8 | public UnexpectedMapValueTypeException(Type expected, Type got) {
9 | super(expected, got);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedResultTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 |
6 | public class UnexpectedResultTypeException extends FactTypeUseException {
7 | private static final long serialVersionUID = 1551922923060851569L;
8 | private Type result;
9 |
10 | public UnexpectedResultTypeException(Type result, Throwable cause) {
11 | super("Unexpected result " + result, cause);
12 | this.result = result;
13 | }
14 |
15 | public Type getResult() {
16 | return result;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnexpectedTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnexpectedTypeException extends FactTypeUseException {
6 | private static final long serialVersionUID = -5107803679675463540L;
7 | private Type expected;
8 | private Type got;
9 |
10 | public UnexpectedTypeException(Type expected, Type got) {
11 | super("Expected " + expected + ", but got " + got);
12 | this.expected = expected;
13 | this.got = got;
14 | }
15 |
16 | public boolean hasExpected() {
17 | return expected != null;
18 | }
19 |
20 | public Type getExpected() {
21 | return expected;
22 | }
23 |
24 | public Type getGiven() {
25 | return got;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/exceptions/UnsupportedTypeException.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.exceptions;
2 |
3 | import org.eclipse.imp.pdb.facts.type.Type;
4 |
5 | public class UnsupportedTypeException extends FactTypeUseException {
6 | private static final long serialVersionUID = -8995093767494157052L;
7 | private Type type;
8 | public UnsupportedTypeException(String explanation, Type type) {
9 | super(explanation);
10 | this.type = type;
11 | }
12 |
13 | public Type getType() {
14 | return type;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/impl/AbstractWriter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009-2013 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | *
10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts.impl;
13 |
14 | import org.eclipse.imp.pdb.facts.IValue;
15 | import org.eclipse.imp.pdb.facts.IWriter;
16 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
17 |
18 | public abstract class AbstractWriter implements IWriter {
19 | public void insertAll(Iterable extends IValue> collection) throws FactTypeUseException {
20 | for (IValue v : collection) {
21 | insert(v);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/impl/primitive/ICanBecomeABigInteger.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009-2013 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | *
10 | * * Arnold Lankamp - interfaces and implementation
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts.impl.primitive;
13 |
14 | import java.math.BigInteger;
15 |
16 | /**
17 | * Strangely named class, which defines that the implementor can convert something to a big integer.
18 | *
19 | * @author Arnold Lankamp
20 | */
21 | public interface ICanBecomeABigInteger{
22 |
23 | /**
24 | * Returns the big integer.
25 | *
26 | * @return The big integer.
27 | */
28 | BigInteger toBigInteger();
29 | }
30 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/impl/primitive/IURI.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.impl.primitive;
2 |
3 | import java.net.URI;
4 |
5 | public interface IURI {
6 | String getScheme();
7 | String getAuthority() throws UnsupportedOperationException;
8 | String getPath() throws UnsupportedOperationException;
9 | String getFragment() throws UnsupportedOperationException;
10 | String getQuery() throws UnsupportedOperationException;
11 | Boolean hasAuthority();
12 | Boolean hasPath();
13 | Boolean hasFragment();
14 | Boolean hasQuery();
15 | URI getURI();
16 | }
17 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/impl/util/sharing/IShareable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009 Centrum Wiskunde en Informatica (CWI)
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Arnold Lankamp - interfaces and implementation
10 | *******************************************************************************/
11 | package org.eclipse.imp.pdb.facts.impl.util.sharing;
12 |
13 | /**
14 | * Indicates that the implementing object is shareable.
15 | *
16 | * @author Arnold Lankamp
17 | */
18 | public interface IShareable{
19 |
20 | /**
21 | * Computes the hashcode for 'this' object.
22 | *
23 | * @return The hashcode
24 | *
25 | * @see java.lang.Object#hashCode()
26 | */
27 | int hashCode();
28 |
29 | /**
30 | * Checks if the given object is 'truely' equal to 'this' object.
31 | *
32 | * @param shareable
33 | * The object to compare with.
34 | * @return True if the given object is equal to 'this' object; false otherwise.
35 | */
36 | boolean equivalent(IShareable shareable);
37 | }
38 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/io/AbstractBinaryReader.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.io;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 |
6 | import org.eclipse.imp.pdb.facts.IValue;
7 | import org.eclipse.imp.pdb.facts.IValueFactory;
8 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
9 | import org.eclipse.imp.pdb.facts.type.Type;
10 | import org.eclipse.imp.pdb.facts.type.TypeFactory;
11 | import org.eclipse.imp.pdb.facts.type.TypeStore;
12 |
13 | public abstract class AbstractBinaryReader implements IValueBinaryReader {
14 | public IValue read(IValueFactory factory, Type type, InputStream stream)
15 | throws FactTypeUseException, IOException {
16 | return read(factory, new TypeStore(), type, stream);
17 | }
18 |
19 | public IValue read(IValueFactory factory, InputStream stream)
20 | throws FactTypeUseException, IOException {
21 | return read(factory, new TypeStore(), TypeFactory.getInstance().valueType(), stream);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/io/AbstractTextReader.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.io;
2 |
3 | import java.io.IOException;
4 | import java.io.Reader;
5 |
6 | import org.eclipse.imp.pdb.facts.IValue;
7 | import org.eclipse.imp.pdb.facts.IValueFactory;
8 | import org.eclipse.imp.pdb.facts.exceptions.FactTypeUseException;
9 | import org.eclipse.imp.pdb.facts.type.Type;
10 | import org.eclipse.imp.pdb.facts.type.TypeFactory;
11 | import org.eclipse.imp.pdb.facts.type.TypeStore;
12 |
13 | public abstract class AbstractTextReader implements IValueTextReader {
14 | public IValue read(IValueFactory factory, Type type, Reader reader)
15 | throws FactTypeUseException, IOException {
16 | return read(factory, new TypeStore(), type, reader);
17 | }
18 |
19 | public IValue read(IValueFactory factory, Reader reader)
20 | throws FactTypeUseException, IOException {
21 | return read(factory, new TypeStore(), TypeFactory.getInstance().valueType(), reader);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/io/IValueBinaryWriter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) CWI 2008
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * Jurgen Vinju (jurgenv@cwi.nl) - initial API and implementation
10 |
11 | *******************************************************************************/
12 |
13 | package org.eclipse.imp.pdb.facts.io;
14 |
15 | import java.io.IOException;
16 | import java.io.OutputStream;
17 |
18 | import org.eclipse.imp.pdb.facts.IValue;
19 | import org.eclipse.imp.pdb.facts.type.TypeStore;
20 |
21 | /**
22 | * An instance of IValueWriter can serialize all types of IValues.
23 | * There should be a corresponding IValueReader to de-serialize them
24 | * back to IValues.
25 | *
26 | * @author jurgenv
27 | *
28 | */
29 | public interface IValueBinaryWriter {
30 | void write(IValue value, OutputStream stream) throws IOException;
31 | void write(IValue value, OutputStream stream, boolean compression) throws IOException;
32 | void write(IValue value, OutputStream stream, TypeStore typeStore) throws IOException;
33 | void write(IValue value, OutputStream stream, boolean compression, TypeStore typeStore) throws IOException;
34 | }
35 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/type/ITypeVisitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008 CWI.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * jurgen@vinju.org
10 |
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts.type;
13 |
14 | /**
15 | * Visitor interface for all kinds of Types
16 | *
17 | * @param the result type of the visit methods
18 | */
19 | public interface ITypeVisitor {
20 | T visitReal(Type type) throws E;
21 | T visitInteger(Type type) throws E;
22 | T visitRational(Type type) throws E;
23 | T visitList(Type type) throws E;
24 | T visitMap(Type type) throws E;
25 | T visitNumber(Type type) throws E;
26 | T visitAlias(Type type) throws E;
27 | T visitSet(Type type) throws E;
28 | T visitSourceLocation(Type type) throws E;
29 | T visitString(Type type) throws E;
30 | T visitNode(Type type) throws E;
31 | T visitConstructor(Type type) throws E;
32 | T visitAbstractData(Type type) throws E;
33 | T visitTuple(Type type) throws E;
34 | T visitValue(Type type) throws E;
35 | T visitVoid(Type type) throws E;
36 | T visitBool(Type type) throws E;
37 | T visitParameter(Type type) throws E;
38 | T visitExternal(Type type) throws E;
39 | T visitDateTime(Type type) throws E;
40 | }
41 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/util/AbstractImmutableMap.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013-2014 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | *
10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts.util;
13 |
14 | import java.util.AbstractMap;
15 | import java.util.Map;
16 |
17 | @Deprecated
18 | public abstract class AbstractImmutableMap extends AbstractMap implements ImmutableMap {
19 |
20 | @Override
21 | public V remove(Object key) {
22 | throw new UnsupportedOperationException();
23 | }
24 |
25 | @Override
26 | public void clear() {
27 | throw new UnsupportedOperationException();
28 | }
29 |
30 | @Override
31 | public V put(K key, V value) {
32 | throw new UnsupportedOperationException();
33 | }
34 |
35 | @Override
36 | public void putAll(Map extends K, ? extends V> m) {
37 | throw new UnsupportedOperationException();
38 | }
39 |
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/util/ArrayUtilsInt.java:
--------------------------------------------------------------------------------
1 | package org.eclipse.imp.pdb.facts.util;
2 |
3 | public class ArrayUtilsInt {
4 |
5 | static int[] arraycopyAndInsertInt(final int[] src, final int idx, final int value) {
6 | final int[] dst = new int[src.length + 1];
7 |
8 | // copy 'src' and insert 1 element(s) at position 'idx'
9 | System.arraycopy(src, 0, dst, 0, idx);
10 | dst[idx] = value;
11 | System.arraycopy(src, idx, dst, idx + 1, src.length - idx);
12 |
13 | return dst;
14 | }
15 |
16 | static int[] arraycopyAndRemoveInt(final int[] src, final int idx) {
17 | final int[] dst = new int[src.length - 1];
18 |
19 | // copy 'src' and remove 1 element(s) at position 'idx'
20 | System.arraycopy(src, 0, dst, 0, idx);
21 | System.arraycopy(src, idx + 1, dst, idx, src.length - idx - 1);
22 |
23 | return dst;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/util/EmptySupplierIterator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2014 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | *
10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts.util;
13 |
14 | import java.util.NoSuchElementException;
15 |
16 | public class EmptySupplierIterator implements SupplierIterator {
17 |
18 | @SuppressWarnings("rawtypes")
19 | private static final SupplierIterator EMPTY_ITERATOR = new EmptySupplierIterator();
20 |
21 | @SuppressWarnings("unchecked")
22 | public static SupplierIterator emptyIterator() {
23 | return EMPTY_ITERATOR;
24 | }
25 |
26 | @Override
27 | public boolean hasNext() {
28 | return false;
29 | }
30 |
31 | @Override
32 | public K next() {
33 | throw new NoSuchElementException();
34 | }
35 |
36 | @Override
37 | public V get() {
38 | throw new NoSuchElementException();
39 | }
40 |
41 | @Override
42 | public void remove() {
43 | throw new UnsupportedOperationException();
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/pdb.values/src/org/eclipse/imp/pdb/facts/util/SetMultimap.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2015 CWI
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | *
10 | * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI
11 | *******************************************************************************/
12 | package org.eclipse.imp.pdb.facts.util;
13 |
14 | import java.util.Collection;
15 | import java.util.Comparator;
16 | import java.util.Map;
17 | import java.util.Set;
18 |
19 | public interface SetMultimap {
20 |
21 | V put(final K key, final V val);
22 |
23 | V remove(final java.lang.Object key, final java.lang.Object val);
24 |
25 | void putAll(final SetMultimap extends K, ? extends V> multimap);
26 |
27 | boolean containsValue(Object value);
28 |
29 | Set get(final java.lang.Object o);
30 |
31 | Set getEquivalent(final java.lang.Object o, final Comparator