- java.lang.Object
-
- edu.jas.root.Interval<C>
-
- Type Parameters:
C- coefficient type.
- All Implemented Interfaces:
- java.io.Serializable
public class Interval<C extends RingElem<C> & Rational> extends java.lang.Object implements java.io.SerializableInterval. For example isolating interval for real roots.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description Cleftleft interval border.Crightright interval border.
-
Constructor Summary
Constructors Constructor and Description Interval(C mid)Constructor.Interval(C left, C right)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancontains(C c)Test if an element is contained in this interval.booleancontains(Interval<C> vc)Test if an interval is contained in this interval.Interval<C>copy()Copy this.booleanequals(java.lang.Object b)Comparison with any other object.inthashCode()Hash code for this Interval.Clength()Length.Cmiddle()Middle point.CrandomPoint()Random point of interval.BigRationalrationalLength()BigRational Length.BigRationalrationalMiddle()Rational middle point.BigDecimaltoDecimal()BigDecimal representation of Interval.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoString()String representation of Interval.
-
-
-
Constructor Detail
-
Interval
public Interval(C left, C right)
Constructor.- Parameters:
left- interval border.right- interval border.
-
Interval
public Interval(C mid)
Constructor.- Parameters:
mid- left and right interval border.
-
-
Method Detail
-
toString
public java.lang.String toString()
String representation of Interval.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Returns:
- script compatible representation for this Interval.
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this Interval.- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
contains
public boolean contains(C c)
Test if an element is contained in this interval.- Parameters:
c- element to test.- Returns:
- true, if left <= b <= right;
-
contains
public boolean contains(Interval<C> vc)
Test if an interval is contained in this interval.- Parameters:
vc- interval to test.- Returns:
- true, if left <= vc.left and vc.right <= right;
-
length
public C length()
Length.- Returns:
- |left-right|;
-
rationalLength
public BigRational rationalLength()
BigRational Length.- Returns:
- |left-right|;
-
toDecimal
public BigDecimal toDecimal()
BigDecimal representation of Interval.
-
rationalMiddle
public BigRational rationalMiddle()
Rational middle point.- Returns:
- (left+right)/2;
-
middle
public C middle()
Middle point.- Returns:
- (left+right)/2;
-
randomPoint
public C randomPoint()
Random point of interval.- Returns:
- a random point contained in this interval.
-
-
DMelt 3.0 © DataMelt by jWork.ORG