Browse Source

Code tidying in parser/ast/Declaration classes.

accumulation-v4.7
Dave Parker 8 years ago
parent
commit
435e365c89
  1. 2
      prism/src/parser/ast/Declaration.java
  2. 26
      prism/src/parser/ast/DeclarationBool.java
  3. 25
      prism/src/parser/ast/DeclarationClock.java
  4. 25
      prism/src/parser/ast/DeclarationInt.java
  5. 25
      prism/src/parser/ast/DeclarationIntUnbounded.java
  6. 2
      prism/src/parser/ast/DeclarationType.java

2
prism/src/parser/ast/Declaration.java

@ -94,7 +94,7 @@ public class Declaration extends ASTElement
/**
* Get the specified initial value of this variable,
* using the default value for its type if not specified.
* using the default value for its type if not specified.
*/
public Expression getStartOrDefault()
{

26
prism/src/parser/ast/DeclarationBool.java

@ -41,43 +41,27 @@ public class DeclarationBool extends DeclarationType
setType(TypeBool.getInstance());
}
/**
* Return the default start value for a variable of this type.
*/
@Override
public Expression getDefaultStart()
{
return Expression.False();
}
/*TODO
public Expression getStart(ModulesFile parent)
{
if (parent != null && parent.getInitialStates() != null)
return null;
return start != null ? start : Expression.False();
}*/
// Methods required for ASTElement:
/**
* Visitor method.
*/
@Override
public Object accept(ASTVisitor v) throws PrismLangException
{
return v.visit(this);
}
/**
* Convert to string.
*/
@Override
public String toString()
{
return "bool";
}
/**
* Perform a deep copy.
*/
@Override
public ASTElement deepCopy()
{
DeclarationBool ret = new DeclarationBool();

25
prism/src/parser/ast/DeclarationClock.java

@ -40,47 +40,26 @@ public class DeclarationClock extends DeclarationType
setType(TypeClock.getInstance());
}
/**
* Return the default start value for a variable of this type.
*/
@Override
public Expression getDefaultStart()
{
return Expression.Double(0);
}
/* TODO:
@Override
public Expression getStart(ModulesFile parent)
{
if (parent != null && parent.getInitialStates() != null)
return null;
return start != null ? start : low;
}
*/
// Methods required for ASTElement:
/**
* Visitor method.
*/
@Override
public Object accept(ASTVisitor v) throws PrismLangException
{
return v.visit(this);
}
/**
* Convert to string.
*/
@Override
public String toString()
{
return "clock";
}
/**
* Perform a deep copy.
*/
@Override
public ASTElement deepCopy()
{

25
prism/src/parser/ast/DeclarationInt.java

@ -68,47 +68,26 @@ public class DeclarationInt extends DeclarationType
return high;
}
/**
* Return the default start value for a variable of this type.
*/
@Override
public Expression getDefaultStart()
{
return low;
}
/* TODO:
@Override
public Expression getStart(ModulesFile parent)
{
if (parent != null && parent.getInitialStates() != null)
return null;
return start != null ? start : low;
}
*/
// Methods required for ASTElement:
/**
* Visitor method.
*/
@Override
public Object accept(ASTVisitor v) throws PrismLangException
{
return v.visit(this);
}
/**
* Convert to string.
*/
@Override
public String toString()
{
return "[" + low + ".." + high + "]";
}
/**
* Perform a deep copy.
*/
@Override
public ASTElement deepCopy()
{

25
prism/src/parser/ast/DeclarationIntUnbounded.java

@ -40,47 +40,26 @@ public class DeclarationIntUnbounded extends DeclarationType
setType(TypeInt.getInstance());
}
/**
* Return the default start value for a variable of this type.
*/
@Override
public Expression getDefaultStart()
{
return Expression.Int(0);
}
/* TODO:
@Override
public Expression getStart(ModulesFile parent)
{
if (parent != null && parent.getInitialStates() != null)
return null;
return start != null ? start : low;
}
*/
// Methods required for ASTElement:
/**
* Visitor method.
*/
@Override
public Object accept(ASTVisitor v) throws PrismLangException
{
return v.visit(this);
}
/**
* Convert to string.
*/
@Override
public String toString()
{
return "int";
}
/**
* Perform a deep copy.
*/
@Override
public ASTElement deepCopy()
{

2
prism/src/parser/ast/DeclarationType.java

@ -30,7 +30,7 @@ package parser.ast;
public abstract class DeclarationType extends ASTElement
{
/**
* Return the default start value for a variable of this type.
* Return the default start value for a variable of this type, as an Expression.
*/
public abstract Expression getDefaultStart();
}
Loading…
Cancel
Save