Class PropertyCycles

java.lang.Object
org.ek9lang.compiler.support.PropertyCycles

public final class PropertyCycles extends Object
THE reading of phase 5's property-cycle marks (phase5/PropertyCycleMarker) - use this, never the squirrelled data directly. Phase 7 synthesis asks it whether a type's GENERATED operators need the runtime cycle guard (Contract 13) and which fields a generated #? must leave out.

A concrete parameterisation of a developer's generic that phase 5 never saw (phase 7 still makes a few) has no mark at all; it is treated as cyclic, so it is guarded - a guard on an acyclic type costs a little time and is never wrong, a missing one is a StackOverflowError.

  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Can an object of this type reach itself through its properties?
    static boolean
    Must a generated #? on this type leave this field out? True for a field of a cyclic type that can lead back to an object of that type; the hash is then a subset of what == compares, so equal graphs (even co-inductively equal cycles) hash alike, and it never recurses round the loop.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isCyclic

      public static boolean isCyclic(IAggregateSymbol aggregate)
      Can an object of this type reach itself through its properties?
    • leavesOutOfHash

      public static boolean leavesOutOfHash(IAggregateSymbol owner, ISymbol field)
      Must a generated #? on this type leave this field out? True for a field of a cyclic type that can lead back to an object of that type; the hash is then a subset of what == compares, so equal graphs (even co-inductively equal cycles) hash alike, and it never recurses round the loop.
      Parameters:
      owner - the aggregate the generated operator belongs to
      field - one of its fields