Package org.btrplace.btrpsl.element
Class BtrpString
java.lang.Object
org.btrplace.btrpsl.element.DefaultBtrpOperand
org.btrplace.btrpsl.element.BtrpString
- All Implemented Interfaces:
BtrpOperand
,Copyable<BtrpOperand>
public class BtrpString extends DefaultBtrpOperand
A string element in the language.
Support concatenation with numbers and other strings
- Author:
- Fabien Hermenier
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.btrplace.btrpsl.element.BtrpOperand
BtrpOperand.Type
-
Constructor Summary
Constructors Constructor Description BtrpString(String str)
Make a new element. -
Method Summary
Modifier and Type Method Description BtrpString
copy()
Make a deep copy of the object.int
degree()
Get the degree of the operand.BtrpNumber
eq(BtrpOperand other)
Check if this operand is equals to another one.boolean
equals(Object o)
int
hashCode()
BtrpString
plus(BtrpOperand o)
Computes the addition of this operand with another one.String
toString()
BtrpOperand.Type
type()
Get the type of the operand.Methods inherited from class org.btrplace.btrpsl.element.DefaultBtrpOperand
div, geq, gt, label, minus, negate, not, power, prettyType, prettyType, prettyType, remainder, setLabel, times
-
Constructor Details
-
BtrpString
Make a new element.- Parameters:
str
- the value of the element.
-
-
Method Details
-
copy
Description copied from interface:Copyable
Make a deep copy of the object.- Returns:
- a deep copy
-
type
Description copied from interface:BtrpOperand
Get the type of the operand.- Returns:
- a type
-
degree
public int degree()Description copied from interface:BtrpOperand
Get the degree of the operand. A degree of 0 indicates a single value. A degree of 1 indicates a set of single value. A degree of 2 indicate a set of set of values. Basically. An operand with a degree n is a set of elements with all having the degree n - 1- Returns:
- a positive integer
-
toString
-
equals
-
hashCode
public int hashCode() -
eq
Description copied from interface:BtrpOperand
Check if this operand is equals to another one.- Specified by:
eq
in interfaceBtrpOperand
- Overrides:
eq
in classDefaultBtrpOperand
- Parameters:
other
- the operand to compare to- Returns:
BtrpNumber.TRUE
if both operand are equals,BtrpNumber.FALSE
otherwise
-
plus
Description copied from interface:BtrpOperand
Computes the addition of this operand with another one.- Specified by:
plus
in interfaceBtrpOperand
- Overrides:
plus
in classDefaultBtrpOperand
- Parameters:
o
- the other operand- Returns:
- the result of the addition
-