code: protected State calculateTargetState(RepositoryResourceImpl matchingResource) {
          State targetState = _desiredStateIfNoMatchingFound;
          if (matchingResource != null) {
              if (_desiredStateIfMatchingFound == null) {
                  targetState = matchingResource.getState();
              } else {
                  targetState = _desiredStateIfMatchingFound;
              }
          }
  
          return targetState;
      }
docs: Works out the target state based on the values passed to the constructor and whether a matching resource was found
  If there is no matching resource use desiredStateIfNoMatchingFound. If there is a matching resource and a
  desiredStateIfMatchingFound state has been set then use it. If a desiredStateIfMatchingFound has not been set (its
  null) then use the matching resource's state
  
  @param matchingResource
  @return