Saves the current polyline

@return true if the polyline is better than any previously saved result false if not and it wasn't saved
350544
boolean savePolyline() {
		int N = loops ? 3 : 2;

		// if a polyline of this size has already been saved then over write it
		CandidatePolyline c;
		if( list.size() <= polylines.size+N-1 ) {
			c = polylines.get( list.size()-N );
			// sanity check
			if( c.splits.size != list.size() )
				throw new RuntimeException("Egads saved polylines aren't in the expected order");
		} else {
			c = polylines.grow();
			c.reset();
			c.score = Double.MAX_VALUE;
		}

		double foundScore = computeScore(list,cornerScorePenalty, loops);

		// only save the results if it's an improvement
		if( c.score > foundScore ) {
			c.score = foundScore;
			c.splits.reset();
			c.sideErrors.reset();
			Element<Corner> e = list.getHead();
			double maxSideError = 0;
			while (e != null) {
				maxSideError = Math.max(maxSideError,e.object.sideError);
				c.splits.add(e.object.index);
				c.sideErrors.add(e.object.sideError);
				e = e.next;
			}
			c.maxSideError = maxSideError;
			return true;
		} else {
			return false;
		}
	}
272921
public boolean flush() {
        boolean ret = true;
        PrintWriter out = null;
        
        // Save source water marks
        try {
            // Backup the original file
            if (file.exists()) {
                if (fileOriginal.exists()) {
                    fileOriginal.delete();
                }

                file.renameTo(fileOriginal);
            }

            // Overwrite the existing file
            out = new PrintWriter(new FileOutputStream(file));
            for (String source : sourceWaterMarkMap.keySet()) {
                WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source);
                out.println(wmEntry);
            }
            out.flush();
        } catch (IOException ioe) {
            logger.error("Failed to flush water marks", ioe);
            ret = false;
        } finally {
            if (out != null) {
                out.close();
                out = null;
            }
        }

        return ret;
    }
303274
public function save()
    {
        if ($this->root !== $this) {
            return $this->root->save();
        }
        if (! isset($this->store)) {
            return false;
        }
        if (! $this->updated) {
            return true;
        }
        $this->store->open(true);
        $this->store->write($this->data);
        $this->store->close();
        $this->updated = false;
        return true;
    }
623218
@Override
	public boolean save() {
		for (CallbackListener callbackListener : this.callbackListeners) {
			callbackListener.beforeSave(this);
		}
		boolean ret = super.save();
		if (this.syncToRedis && ret) {
			this.saveToRedis();
		}
		for (CallbackListener callbackListener : this.callbackListeners) {
			callbackListener.afterSave(this);
		}
		return ret;
	}
69582
public function save()
    {

        $fields = array_except($this->attributes, ["_index", "_type", "_id", "_score"]);

        if ($this->exists()) {

            // Update the current document

            $this->newQuery()->id($this->getID())->update($fields);

        } else {

            // Check if model key exists in items

            if (array_key_exists("_id", $this->attributes)) {
                $created = $this->newQuery()->id($this->attributes["_id"])->insert($fields);
                $this->_id = $this->attributes["_id"];
            } else {
                $created = $this->newQuery()->insert($fields);
                $this->_id = $created->_id;
            }

            $this->setConnection($this->getConnection());
            $this->setIndex($created->_index);

            // Match earlier versions

            $this->_index = $created->_index;
            $this->_type = $this->type;

            $this->exists = true;
        }

        return $this;
    }
236960
static boolean polylineRelatePolyline_(Polyline polyline_a,
			Polyline polyline_b, double tolerance, String scl,
			ProgressTracker progress_tracker) {
		RelationalOperationsMatrix relOps = new RelationalOperationsMatrix();
		relOps.resetMatrix_();
		relOps.setPredicates_(scl);
		relOps.setLineLinePredicates_();

		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		polyline_a.queryEnvelope2D(env_a);
		polyline_b.queryEnvelope2D(env_b);

		boolean bRelationKnown = false;
		boolean b_disjoint = RelationalOperations.envelopeDisjointEnvelope_(
				env_a, env_b, tolerance, progress_tracker);

		if (b_disjoint) {
			relOps.lineLineDisjointPredicates_(polyline_a, polyline_b);
			bRelationKnown = true;
		}

		if (!bRelationKnown) {
			// Quick rasterize test to see whether the the geometries are
			// disjoint, or if one is contained in the other.
			int relation = RelationalOperations
					.tryRasterizedContainsOrDisjoint_(polyline_a, polyline_b,
							tolerance, false);

			if (relation == RelationalOperations.Relation.disjoint) {
				relOps.lineLineDisjointPredicates_(polyline_a, polyline_b);
				bRelationKnown = true;
			}
		}

		if (!bRelationKnown) {
			EditShape edit_shape = new EditShape();
			int geom_a = edit_shape.addGeometry(polyline_a);
			int geom_b = edit_shape.addGeometry(polyline_b);
			relOps.setEditShapeCrackAndCluster_(edit_shape, tolerance,
					progress_tracker);
			relOps.m_cluster_index_a = relOps.m_topo_graph
					.createUserIndexForClusters();
			relOps.m_cluster_index_b = relOps.m_topo_graph
					.createUserIndexForClusters();
			markClusterEndPoints_(geom_a, relOps.m_topo_graph,
					relOps.m_cluster_index_a);
			markClusterEndPoints_(geom_b, relOps.m_topo_graph,
					relOps.m_cluster_index_b);
			relOps.computeMatrixTopoGraphHalfEdges_(geom_a, geom_b);
			relOps.m_topo_graph
					.deleteUserIndexForClusters(relOps.m_cluster_index_a);
			relOps.m_topo_graph
					.deleteUserIndexForClusters(relOps.m_cluster_index_b);
			relOps.m_topo_graph.removeShape();
		}

		boolean bRelation = relationCompare_(relOps.m_matrix, relOps.m_scl);
		return bRelation;
	}
72388
function save() {
         this._colorStack.push(this.currentColor.clone());

         this._matrixStack.push(this.currentTransform.clone());

         if (this.gl.isEnabled(this.gl.SCISSOR_TEST)) {
           // FIXME avoid slice and object realloc
           this._scissorStack.push(this.currentScissor.slice());
         }
       }
1186807
public function save()
    {
        $this->updateTimestamps();

         /**
         * If this is a unique relationship we should check for an existing
         * one of the same type and direction for the $parent node before saving
         * and delete it, only if we are not updating a relationship.
         */
        if ($this->unique && ! $this->exists())
        {
            $parent = $this->asNode($this->parent);
            $existing = $parent->getFirstRelationship((array) $this->type, $this->getRealDirection($this->direction));

            if ( ! empty($existing))
            {
                $existing->delete();
            }
        }

        $this->setRelationProperties($this->toArray());

        $saved = $this->relation->save();

        if ($saved)
        {
            // Let's refresh the relation we alreay have set so that
            // we make sure that it is totally in sync with the saved one.
            $this->setRelation($this->relation);

            return true;
        }

        return  false;
    }
1263923
public boolean save() 
    {
        boolean    blnRet    = false;
        File       objFile   = null;
        String     strName   = null;
        String     strTemp   = null;
        Iterator<String>   itrSec    = null;
        INISection objSec    = null;
        FileWriter objWriter = null;

        try
        {
            if (this.mhmapSections.size() == 0) return false;
            objFile = new CSFile(this.mstrFile);
            if (objFile.exists()) objFile.delete();
            objWriter = new FileWriter(objFile);
            itrSec = this.mhmapSections.keySet().iterator();
            while (itrSec.hasNext())
            {
                strName = (String) itrSec.next();
                objSec = (INISection) this.mhmapSections.get(strName);
                strTemp = objSec.toString();
                objWriter.write(strTemp);
                objWriter.write("\r\n");
                objSec = null;
            }
            blnRet = true;
        }
        catch (IOException IOExIgnore)
        {
        }
        finally
        {
            if (objWriter != null)
            {
                closeWriter(objWriter);
                objWriter = null;
            }
            if (objFile != null) objFile = null;
            if (itrSec != null) itrSec = null;
        }
        return blnRet;
    }
1273442
public function postSave()
    {

        // check if the model already exists
        if ((!isset($this->revisionEnabled) || $this->revisionEnabled) && $this->updating) {
            // if it does, it means we're updating

            $changes_to_record = $this->changedRevisionableFields();

            $revisions = array();

            foreach ($changes_to_record as $key => $change) {
                $revisions[] = array(
                    'revisionable_type'     => $this->getMorphClass(),
                    'revisionable_id'       => $this->getKey(),
                    'key'                   => $key,
                    'old_value'             => array_get($this->originalData, $key),
                    'new_value'             => $this->updatedData[$key],
                    'user_id'               => $this->getSystemUserId(),
                    'created_at'            => new \DateTime(),
                    'updated_at'            => new \DateTime(),
                );
            }

            if (count($revisions) > 0) {
                $revision = static::newModel();
                \DB::table($revision->getTable())->insert($revisions);
            }
        }
    }
1312348
public function save()
    {

        if ($this->id) {
            $this->id = shmop_open($this->key, $this->mode, $this->permission, $this->size);
        }

        @shmop_write($this->id, serialize($this->data), $this->offset);

        return true;
    }
248660
public function save()
    {
        $result = true;

        if (!empty($this->changedData)) {
            foreach ($this->changedData as $scope => $rowData) {
                foreach ($rowData as $layoutName => $layoutData) {
                    if (empty($scope) || empty($layoutName)) {
                        continue;
                    }
                    $layoutPath = $this->getLayoutPath($scope, true);
                    $data = Json::encode($layoutData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);

                    $result &= $this->getFileManager()->putContents(array($layoutPath, $layoutName.'.json'), $data);
                }
            }
        }

        if ($result == true) {
            $this->clearChanges();
        }

        return (bool) $result;
    }
116080
private boolean askToSave() {
        if (mainFrame.isProjectChanged()) {
            int response = JOptionPane.showConfirmDialog(mainFrame, L10N.getLocalString("dlg.save_current_changes",
                    "The current project has been changed, Save current changes?"), L10N.getLocalString("dlg.save_changes",
                            "Save Changes?"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);

            if (response == JOptionPane.YES_OPTION) {
                if (mainFrame.getSaveFile() != null) {
                    save();
                } else {
                    saveAs();
                }
            } else if (response == JOptionPane.CANCEL_OPTION)
            {
                return true;
                // IF no, do nothing.
            }
        }
        return false;
    }
1066335
public boolean saveNewRow() {

        // check the fields of the primary keys whether one is empty
        boolean           onePKempty = false;
        int               tmp;
        PreparedStatement ps = null;

        for (tmp = 0; tmp < primaryKeys.length; tmp++) {
            if (komponente[pkColIndex[tmp]].getContent().equals("")) {
                onePKempty = true;

                break;
            }
        }

        if (onePKempty) {
            komponente[pkColIndex[tmp]].requestFocus();
            ZaurusEditor.printStatus("no value for primary key "
                                     + primaryKeys[tmp]);

            return false;
        }    // end of if (onePKempty)

        // build the insert string
        String insertString = "INSERT INTO " + tableName + " VALUES(";

        for (int j = 0; j < columns.length; j++) {
            if (j > 0) {
                insertString += ", ";
            }

            insertString += "?";
        }    // end of for (int i=0; i<columns.length; i++)

        insertString += ")";

        // System.out.println("insert string "+insertString);
        try {

            // fill the question marks
            ps = cConn.prepareStatement(insertString);

            ps.clearParameters();

            int i;

            for (i = 0; i < columns.length; i++) {
                ps.setObject(i + 1, komponente[i].getContent());
            }

            ps.executeUpdate();
            ZaurusEditor.printStatus("new row was saved to table "
                                     + tableName);

            return true;
        } catch (SQLException e) {
            ZaurusEditor.printStatus("SQL Exception: " + e.getMessage());

            return false;
        } finally {
            try {
                if (ps != null) {
                    ps.close();
                }
            } catch (SQLException e) {}
        }
    }
797396
public function save()
    {
        $query = new QueryBuilder(self::$_connection);

        if($this->_isInsert) {
            $query->insert($this->getTable())
                  ->values($this->_changed);

            $id = self::$_connection->insert($query->getQuery());
            $this->_data[$this->_primaryKey] = $id;

            $this->_isInsert = false;
            $this->_changed  = [];

            return;
        }

        $query->update($this->getTable())
              ->set($this->_changed)
              ->where([
                  $this->_primaryKey => $this->_data[$this->_primaryKey]
              ])
              ->execute();

        $this->_changed = [];
    }
302422
public function save()
    {
        // No payload to save.
        if (! $this->hasPayLoad()) {
            return false;
        }

        // Save the token.
        return (bool) file_put_contents($this->getFilePath(), collect($this->payLoad)->toJson(), LOCK_EX);
    }
81516
public boolean savePool() {
        if (newTopicPool.isEmpty() && updatedTopicPool.isEmpty()) return true;
        try {
            // Save the new topics
            if (!newTopicPool.isEmpty()) {
                final CollectionWrapper<TopicWrapper> response = topicProvider.createTopics(newTopicPool);
                // Check that the response isn't empty (ie failed)
                if (response == null) return false;
                if (response.getItems() == null) return false;
                // The response is valid so set it as the pool
                newTopicPool = response;
            }

            // Update the existing topics
            if (!updatedTopicPool.isEmpty()) {
                final CollectionWrapper<TopicWrapper> response = topicProvider.updateTopics(updatedTopicPool);
                // Check that the response isn't empty (ie failed)
                if (response == null) return false;
                if (response.getItems() == null) return false;
                // The response is valid so set it as the pool
                updatedTopicPool = response;
            }
            initialised = true;
            return true;
        } catch (Exception e) {
            log.error("", e);
            return false;
        }
    }