pnets

Struct Marking

Source
pub struct Marking<T: Ord + Copy> { /* private fields */ }
Expand description

Hollow usize vector sorted with generic indices

Allow manipulation of big vector which contains a lot of zeroes. This type of vector is very useful to represent the connection between locations and transitions in order to avoid creating a matrix mainly filled with zeros.

Implementations§

Source§

impl<T> Marking<T>
where T: Ord + Copy,

Source

pub fn iter(&self) -> Iter<'_, (T, usize)>

Return a iterator over all present elements in the marking

Source

pub fn iter_with<'m>(&'m self, other: &'m Self) -> DualMarkingIterator<'m, T>

Return an iterator over two marking at same time. Useful to compare marking with a complexity of O(2n) instead of O(2nln(n))

Source

pub fn clear(&mut self)

Remove all items in marking

Source

pub fn len(&self) -> usize

Returns the number of elements in the marking.

Source

pub fn is_empty(&self) -> bool

Returns true if the vector contains no elements.

Source

pub fn insert_or_add(&mut self, index: T, weight: usize)

Increment the value contained in the marking by weight.

If the tag does not contain a value associated with the index, weight is inserted into the index.

Source

pub fn insert_or_min(&mut self, index: T, weight: usize)

Keeps the minimum value between that contained in the marking and weight.

If the tag does not contain a value associated with the index, weight is inserted into the index.

Source

pub fn insert_or_max(&mut self, index: T, weight: usize)

Keeps the maximum value between that contained in the marking and weight.

If the tag does not contain a value associated with the index, weight is inserted into the index.

Source

pub fn delete(&mut self, index: T)

Delete a specific index from the marking

Trait Implementations§

Source§

impl<T: Clone + Ord + Copy> Clone for Marking<T>

Source§

fn clone(&self) -> Marking<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Ord + Copy> Debug for Marking<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + Ord + Copy> Default for Marking<T>

Source§

fn default() -> Marking<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Index<T> for Marking<T>
where T: Ord + Copy,

Source§

type Output = usize

The returned type after indexing.
Source§

fn index(&self, index: T) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: PartialEq + Ord + Copy> PartialEq for Marking<T>

Source§

fn eq(&self, other: &Marking<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Ord + Copy> StructuralPartialEq for Marking<T>

Auto Trait Implementations§

§

impl<T> Freeze for Marking<T>

§

impl<T> RefUnwindSafe for Marking<T>
where T: RefUnwindSafe,

§

impl<T> Send for Marking<T>
where T: Send,

§

impl<T> Sync for Marking<T>
where T: Sync,

§

impl<T> Unpin for Marking<T>
where T: Unpin,

§

impl<T> UnwindSafe for Marking<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.