Search for intermediate shape model by its c2j name.

@return ShapeModel or null if the shape doesn't exist (if it's primitive or container type for example)
6314
public static ShapeModel findShapeModelByC2jNameIfExists(IntermediateModel intermediateModel, String shapeC2jName) {
        for (ShapeModel shape : intermediateModel.getShapes().values()) {
            if (shape.getC2jName().equals(shapeC2jName)) {
                return shape;
            }
        }
        return null;
    }
1116750
@CheckForNull
    protected AbstractMarkerAnnotationModel getModel() {
        if(editor == null) {
            return null;
        }
        IDocumentProvider provider = editor.getDocumentProvider();
        IAnnotationModel model = provider.getAnnotationModel(editor.getEditorInput());
        if (model instanceof AbstractMarkerAnnotationModel) {
            return (AbstractMarkerAnnotationModel) model;
        }
        return null;
    }
1220416
public DTMIterator getContextNodeList()
  {

    try
    {
      DTMIterator cnl = m_xcontext.getContextNodeList();

      return (cnl == null) ? null : (DTMIterator) cnl.cloneWithReset();
    }
    catch (CloneNotSupportedException cnse)
    {

      // should never happen.
      return null;
    }
  }
956480
def find_shape(self, canvas_x, canvas_y):
        '''
        
        '''
        shape_x, shape_y, w = self.canvas_to_shapes_transform.dot([canvas_x,
                                                                   canvas_y,
                                                                   1])
        if hasattr(self.space, 'point_query_first'):
            # Assume `pymunk<5.0`.
            shape = self.space.point_query_first((shape_x, shape_y))
        else:
            # Assume `pymunk>=5.0`, where `point_query_first` method has been
            # deprecated.
            info = self.space.point_query_nearest((shape_x, shape_y), 0,
                                                  [pymunk.ShapeFilter
                                                   .ALL_CATEGORIES])
            shape = info.shape if info else None

        if shape:
            return self.bodies[shape.body]
        return None
50507
public TransformType getTransformType() {

		// if no SG, that means a non-crystallographic entry (e.g. NMR). We return AU as type
		if (sg==null) return TransformType.AU;

		int foldType = sg.getAxisFoldType(this.transformId);
		boolean isScrewOrGlide = false;
		Vector3d translScrewComponent = getTranslScrewComponent();
		if (Math.abs(translScrewComponent.x-0.0)>SpaceGroup.DELTA ||
			Math.abs(translScrewComponent.y-0.0)>SpaceGroup.DELTA ||
			Math.abs(translScrewComponent.z-0.0)>SpaceGroup.DELTA) {

			isScrewOrGlide = true;
		}

		if (foldType>1) {

			if (isScrewOrGlide) {
				switch (foldType) {
				case 2:
					return TransformType.TWOFOLDSCREW;
				case 3:
					return TransformType.THREEFOLDSCREW;
				case 4:
					return TransformType.FOURFOLDSCREW;
				case 6:
					return TransformType.SIXFOLDSCREW;
				default:
					throw new NullPointerException("This transformation did not fall into any of the known types! This is most likely a bug.");
				}
			} else {
				switch (foldType) {
				case 2:
					return TransformType.TWOFOLD;
				case 3:
					return TransformType.THREEFOLD;
				case 4:
					return TransformType.FOURFOLD;
				case 6:
					return TransformType.SIXFOLD;
				default:
					throw new NullPointerException("This transformation did not fall into any of the known types! This is most likely a bug.");
				}
			}

		} else if (foldType<0) {
			switch (foldType) {
			case -1:
				return TransformType.ONEBAR;
			case -2:
				if (isScrewOrGlide) {
					return TransformType.GLIDE;
				}
				return TransformType.TWOBAR;
			case -3:
				return TransformType.THREEBAR;
			case -4:
				return TransformType.FOURBAR;
			case -6:
				return TransformType.SIXBAR;
			default:
				throw new NullPointerException("This transformation did not fall into any of the known types! This is most likely a bug.");
			}
		} else {
			if (isIdentity()) {
				return TransformType.AU;
			}
			if (isPureCrystalTranslation()) {
				return TransformType.XTALTRANSL;
			}
			if (isFractionalTranslation()) {
				return TransformType.CELLTRANSL;
			}
			throw new NullPointerException("This transformation did not fall into any of the known types! This is most likely a bug.");
		}

	}
1050141
public I_CmsWidget getWidgetObject() {

        if (getWidget() == null) {
            if (m_params == null) {
                return new CmsInputWidget();
            } else {
                return new CmsInputWidget(m_params);
            }
        }
        try {
            if (m_params == null) {
                return (I_CmsWidget)Class.forName(getWidget()).newInstance();
            }
            Class<?> clazz = Class.forName(getWidget());
            Constructor<?> ctor = clazz.getConstructor(new Class[] {String.class});
            return (I_CmsWidget)ctor.newInstance(new Object[] {m_params});
        } catch (Exception e) {
            return new CmsInputWidget();
        }
    }
657877
public ModelService getModelService(String serviceName){
        ModelService service = getDirectoryServiceClient().getService(serviceName, null);
        return service;
    }
547947
private MemberModel tryFindMemberModelByC2jName(String memberC2jName, boolean ignoreCase) {

        final List<MemberModel> memberModels = getMembers();
        final String expectedName = ignoreCase ? StringUtils.lowerCase(memberC2jName)
                                                : memberC2jName;

        if (memberModels != null) {
            for (MemberModel member : memberModels) {
                String actualName = ignoreCase ? StringUtils.lowerCase(member.getC2jName())
                                                : member.getC2jName();

                if (expectedName.equals(actualName)) {
                    return member;
                }
            }
        }
        return null;
    }
752256
private static ShapeType getShapeTypeFromGeometryMetaData(GeometryMetaData meta) throws SQLException {
        ShapeType shapeType;
        switch (meta.geometryType) {
            case GeometryTypeCodes.MULTILINESTRING:
            case GeometryTypeCodes.LINESTRING:
            case GeometryTypeCodes.MULTILINESTRINGM:
            case GeometryTypeCodes.LINESTRINGM:
            case GeometryTypeCodes.MULTILINESTRINGZ:
            case GeometryTypeCodes.LINESTRINGZ:
                shapeType = meta.hasZ ? ShapeType.ARCZ : ShapeType.ARC;
                break;
            case GeometryTypeCodes.POINT:
                shapeType = meta.hasZ ? ShapeType.POINTZ  : ShapeType.POINT;
                break;
            case GeometryTypeCodes.MULTIPOINT:
                shapeType = meta.hasZ ? ShapeType.MULTIPOINTZ : ShapeType.MULTIPOINT;
                break;
            case GeometryTypeCodes.POLYGON:
            case GeometryTypeCodes.MULTIPOLYGON:
                shapeType = meta.hasZ ? ShapeType.POLYGONZ : ShapeType.POLYGON;
                break;
            default:
                return null;
        }
        return shapeType;
    }
596269
protected function _getSchemaForModel($modelName = null) {
		if (empty($modelName)) {
			return null;
		}

		$modelName = (string)$modelName;
		$cached = $this->_getSchemaCache($modelName);
		if ($cached !== null) {
			return $cached;
		}

		$modelObj = ClassRegistry::init($modelName, true);
		if ($modelObj === false) {
			return null;
		}

		$defaultSchema = [
			'type' => 'string',
			'null' => false,
			'default' => null,
			'length' => null,
		];
		$result = $modelObj->schema();
		$virtualFields = $modelObj->getVirtualField();
		if (!empty($result) && !empty($virtualFields)) {
			foreach ($virtualFields as $virtualFieldName => $virtualFieldValue) {
				$result[$virtualFieldName] = $defaultSchema;
			}
		}
		$this->_setSchemaCache($modelName, $result);

		return $result;
	}
513698
public static Map<String, MergedVertex> getMergedVertexes(Shape shape)
	{
		Map<String, MergedVertex> mergedVertexes = new HashMap<>();

		for (Face f : shape.getFaces())
		{
			for (Vertex v : f.getVertexes())
			{
				MergedVertex mv = mergedVertexes.get(v.baseName());
				if (mv == null)
				{
					mv = new MergedVertex(v);
					mergedVertexes.put(v.baseName(), mv);
				}
				else
					mv.addVertex(v);
			}

		}

		return mergedVertexes;

	}
78649
public function getForeignModel()
    {
        $model = $this->getFullForeignModel();

        if ($this->isModel($model)) {
            return class_basename($model);
        }

        $position = strrpos($model, '\\');

        if ($position !== false) {
            return substr($model, $position + 1);
        }

        return '';
    }
256943
public function getMiddleLayoutModel()
    {
        if ( null === $this->middleLayoutModel )
        {
            $this->middleLayoutModel = $this->getServiceLocator()
                                            ->get( 'Grid\Paragraph\Model\Paragraph\MiddleLayoutModel' );
        }

        return $this->middleLayoutModel;
    }
1335762
function(collapsedModel) {
			if(!this._cursor){
				return null;
			}
			if(this._inParentChain(this._cursor, collapsedModel)){
				this.setCursor(collapsedModel);
				return this._cursor;
			}
			return null;
		}
206430
protected FluentModelTImpl find(String key) {
        for (Map.Entry<String, FluentModelTImpl> entry : this.childCollection.entrySet()) {
            if (entry.getKey().equalsIgnoreCase(key)) {
                return entry.getValue();
            }
        }
        return null;
    }
888567
protected function getModelInformation()
    {
        if (null === $this->model) {
            // @codeCoverageIgnoreStart
            return false;
            // @codeCoverageIgnoreEnd
        }

        return $this->getModelInformationRepository()->getByModel($this->model);
    }
21217
public BoundingBox getBoundingBox() {

		GeometryEnvelope envelope = null;

		long offset = 0;
		boolean hasResults = true;

		while (hasResults) {

			hasResults = false;

			FeatureResultSet resultSet = featureDao.queryForChunk(chunkLimit,
					offset);
			try {
				while (resultSet.moveToNext()) {
					hasResults = true;

					FeatureRow featureRow = resultSet.getRow();
					GeometryEnvelope featureEnvelope = featureRow
							.getGeometryEnvelope();
					if (featureEnvelope != null) {

						if (envelope == null) {
							envelope = featureEnvelope;
						} else {
							envelope = envelope.union(featureEnvelope);
						}

					}
				}
			} finally {
				resultSet.close();
			}

			offset += chunkLimit;
		}

		BoundingBox boundingBox = null;
		if (envelope != null) {
			boundingBox = new BoundingBox(envelope);
		}

		return boundingBox;
	}