///////////////////////////////
185450
public void badParam(String name, String value)
            throws ParseException {
        throw new ParseException("parameter " + name + " has bad value [[" +
                value + "]] in " + ruleStack, 0);
    }
1290284
public void logException(Level level) {
        if (!LOG.isLoggable(level)) {
            return;
        }
        final StringBuilder builder = new StringBuilder();
        builder.append("\n----------------------------------------------------");
        builder.append("\nMonitoringException");
        builder.append("\n----------------------------------------------------");
        builder.append("\nCode:    ").append(code);
        builder.append("\nMessage: ").append(message);
        builder.append("\n----------------------------------------------------");
        if (events != null) {
            for (Event event : events) {
                builder.append("\nEvent:");
                if (event.getMessageInfo() != null) {
                    builder.append("\nMessage id: ").append(event.getMessageInfo().getMessageId());
                    builder.append("\nFlow id:    ").append(event.getMessageInfo().getFlowId());
                    builder.append("\n----------------------------------------------------");
                } else {
                    builder.append("\nNo message id and no flow id");
                }
            }
        }
        builder.append("\n----------------------------------------------------\n");
        LOG.log(level, builder.toString(), this);
    }
846416
@Override public final void lcompute() {
    if( _hi-_lo >= 2 ) { // Multi-key case: just divide-and-conquer to 1 key
      final int mid = (_lo+_hi)>>>1; // Mid-point
      assert _left == null && _rite == null;
      T l = clone();
      T r = clone();
      _left = l; l._reservedMem = 0;
      _rite = r; r._reservedMem = 0;
      _left._hi = mid;          // Reset mid-point
      _rite._lo = mid;          // Also set self mid-point
      setPendingCount(1);
      // Compute min. memory required to run the right branch in parallel.  Min
      // memory equals to the max memory used if the right branch will be
      // executed single threaded (but in parallel with our left branch).
      // Assuming all memory is kept in the tasks and it is halved by reduce
      // operation, the min memory is proportional to the depth of the right
      // subtree.
      long reqMem = (log2(_hi - mid)+3)*memOverheadPerChunk();

      if(!_runSingleThreaded && MemoryManager.tryReserveTaskMem(reqMem)){
        _reservedMem += reqMem;   // Remember the amount of reserved memory to free it later.
        _left.fork();             // Runs in another thread/FJ instance
      } else {
        _left.compute2();
      }
      _rite.compute2();         // Runs in THIS F/J thread
    } else {
      if( _hi > _lo ) {         // Single key?
        try {
          map(_keys[_lo]);      // Get it, run it locally
        } catch( RuntimeException re ) { // Catch user-map-thrown exceptions
          throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]);
        } catch( AssertionError re ) { // Catch user-map-thrown exceptions
          throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]);
        } catch( OutOfMemoryError re ) { // Catch user-map-thrown exceptions
          throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]);
        }
      }
      tryComplete();            // And this task is complete
    }
  }
563984
public void columnSelectionChanged(ListSelectionEvent e)
    {
        if (!e.getValueIsAdjusting())
        {
            int iColumn = m_jTableScreen.getSelectedColumn();
            if (iColumn != -1)
                if (m_thinTableModel != null)   // In case this was freed before I got the message
            {
                Convert converter = m_thinTableModel.getFieldInfo(iColumn);
                BaseApplet baseApplet = this.getBaseApplet();
                if (baseApplet != null)
                {
                    if (converter instanceof FieldInfo)
                        baseApplet.setStatusText(((FieldInfo)converter).getFieldTip());
                    else
                    {
                        TableColumnModel columnModel = m_jTableScreen.getTableHeader().getColumnModel();
                        TableColumn tableColumn = columnModel.getColumn(iColumn);
                        TableCellEditor editor = tableColumn.getCellEditor();
                        String strTip = null;
                        if (editor instanceof JComponent)
                        {
                            String strName = ((JComponent)editor).getName();
                            if (strName != null)
                            {
                                strName += Constants.TIP;
                                strTip = baseApplet.getString(strName);
                                if (strTip == strName)
                                    strTip = baseApplet.getString(((JComponent)editor).getName());
                            }
                        }
                        baseApplet.setStatusText(strTip);
                    }
                    String strLastError = baseApplet.getLastError(0);
                    if ((strLastError != null) && (strLastError.length() > 0))
                        baseApplet.setStatusText(strLastError);
                }
            }
        }
    }
318214
@SuppressWarnings("unchecked")
    public <N> List<N> findOneColumn(String sql, List<?> params, final int mapperColumnIndex,
                                     final Class<N> resultClass) {

        if (sql == null) {
            recordLog(" param sql is null!");
        }

        if (Number.class.isAssignableFrom(resultClass)) {
            if (resultClass.equals(Long.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Long.valueOf(n.longValue());
                    }
                });
            } else if (resultClass.equals(Integer.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Integer.valueOf(n.intValue());
                    }
                });
            } else if (resultClass.equals(Float.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Float.valueOf(n.floatValue());
                    }
                });
            } else if (resultClass.equals(Double.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Double.valueOf(n.doubleValue());
                    }
                });
            } else if (resultClass.equals(Short.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Short.valueOf(n.shortValue());
                    }
                });
            } else if (resultClass.equals(Byte.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Byte.valueOf(n.byteValue());
                    }
                });
            } else {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        return (N) n;
                    }
                });
            }
        } else if (resultClass.equals(String.class)) {
            return findBySQL(sql, params, new RowMapper<N>() {
                public N mapRow(ResultSet rs, int count) throws SQLException {
                    return (N) (rs.getString(mapperColumnIndex));
                }
            });
        } else if (resultClass.equals(Date.class)) {
            return findBySQL(sql, params, new RowMapper<N>() {
                public N mapRow(ResultSet rs, int count) throws SQLException {
                    return (N) (rs.getDate(mapperColumnIndex));
                }
            });
        } else {
            throw new RuntimeException("not supported type");
        }
    }
949124
public function onRender()
    {

        $meta = $this->dataStore->meta();
        $showColumnKeys = array();

        if ($this->columns == array()) {
            if ($row = $this->dataStore[0]) {
                $showColumnKeys = array_keys($row);
            } else if (count($meta["columns"]) > 0) {
                $showColumnKeys = array_keys($meta["columns"]);
            }
        } else {
            foreach ($this->columns as $cKey => $cValue) {

                if ($cKey === "{others}") {
                    $allKeys = array_keys($this->dataStore[0]);
                    foreach ($allKeys as $k) {
                        if (!in_array($k, $showColumnKeys)) {
                            $meta["columns"][$k] = array_merge($meta["columns"][$k], $cValue);
                            array_push($showColumnKeys, $k);
                        }
                    }
                } else {
                    if (gettype($cValue) == "array") {
                        if ($cKey === "#") {
                            $meta["columns"][$cKey] = array(
                                "type" => "number",
                                "label" => "#",
                                "start" => 1,
                            );
                        }

                        $meta["columns"][$cKey] = array_merge($meta["columns"][$cKey], $cValue);
                        if (!in_array($cKey, $showColumnKeys)) {
                            array_push($showColumnKeys, $cKey);
                        }
                    } else {
                        if ($cValue === "#") {
                            $meta["columns"][$cValue] = array(
                                "type" => "number",
                                "label" => "#",
                                "start" => 1,
                            );
                        }
                        if (!in_array($cValue, $showColumnKeys)) {
                            array_push($showColumnKeys, $cValue);
                        }
                    }

                }
            }
        }

        $cleanColumnKeys = array();
        foreach ($showColumnKeys as $key) {
            if (!in_array($key, $this->excludedColumns)) {
                array_push($cleanColumnKeys, $key);
            }
        }
        $showColumnKeys = $cleanColumnKeys;

        if (count($this->group) === 0 && count($this->sorting)>0) {
            $this->dataStore->sort($this->sorting);
        }

        //Prepare data
        $this->template(
            "Table",
            array(
                "showColumnKeys" => $showColumnKeys,
                "meta" => $meta,
            )
        );
    }
751265
void onSelect() {

        if (m_selectHandler != null) {
            String principalType = (String)m_principalTypeSelect.getValue();
            if (CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_ROLE_0).equals(
                principalType)) {
                principalType = CmsRole.PRINCIPAL_ROLE;
            }
            m_selectHandler.onPrincipalSelect(principalType, m_principalName.getValue());
        }
    }
714745
@Override
  public Clustering<M> run(Database database, Relation<V> relation) {
    MutableProgress prog = LOG.isVerbose() ? new MutableProgress("X-means number of clusters", k_max, LOG) : null;

    // Run initial k-means to find at least k_min clusters
    innerKMeans.setK(k_min);
    LOG.statistics(new StringStatistic(KEY + ".initialization", initializer.toString()));
    splitInitializer.setInitialMeans(initializer.chooseInitialMeans(database, relation, k_min, getDistanceFunction()));
    Clustering<M> clustering = innerKMeans.run(database, relation);

    if(prog != null) {
      prog.setProcessed(k_min, LOG);
    }

    ArrayList<Cluster<M>> clusters = new ArrayList<>(clustering.getAllClusters());
    while(clusters.size() <= k_max) {
      // Improve-Structure:
      ArrayList<Cluster<M>> nextClusters = new ArrayList<>();
      for(Cluster<M> cluster : clusters) {
        // Try to split this cluster:
        List<Cluster<M>> childClusterList = splitCluster(cluster, database, relation);
        nextClusters.addAll(childClusterList);
        if(childClusterList.size() > 1) {
          k += childClusterList.size() - 1;
          if(prog != null) {
            if(k >= k_max) {
              prog.setTotal(k + 1);
            }
            prog.setProcessed(k, LOG);
          }
        }
      }
      if(clusters.size() == nextClusters.size()) {
        break;
      }
      // Improve-Params:
      splitInitializer.setInitialClusters(nextClusters);
      innerKMeans.setK(nextClusters.size());
      clustering = innerKMeans.run(database, relation);
      clusters.clear();
      clusters.addAll(clustering.getAllClusters());
    }

    // Ensure that the progress bar finished.
    if(prog != null) {
      prog.setTotal(k);
      prog.setProcessed(k, LOG);
    }
    return new Clustering<>("X-Means Result", "X-Means", clusters);
  }
512149
public void updateChangeLog(final Principal user, final Verb verb, final String linkType, final String linkId, final String object, final Direction direction) {

		if (Settings.ChangelogEnabled.getValue()) {

			final JsonObject obj = new JsonObject();

			obj.add("time",     toElement(System.currentTimeMillis()));
			obj.add("userId",   toElement(user.getUuid()));
			obj.add("userName", toElement(user.getName()));
			obj.add("verb",     toElement(verb));
			obj.add("rel",      toElement(linkType));
			obj.add("relId",    toElement(linkId));
			obj.add("relDir",   toElement(direction));
			obj.add("target",   toElement(object));

			changeLog.append(obj.toString());
			changeLog.append("\n");
		}
	}
838216
@SuppressWarnings("unused")
    private void setDraggingToColumn(int column, boolean isDragging) {
        Collection<ViewHolder> holders = mViewHolders.getColumnItems(column);
        for (ViewHolder holder : holders) {
            holder.setIsDragging(isDragging);
        }

        ViewHolder holder = mHeaderColumnViewHolders.get(column);
        if (holder != null) {
            holder.setIsDragging(isDragging);
        }
    }
507817
@Override
    protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
    {

        KuduSession session = kuduClient.newSession();
        KuduTable table = null;
        try
        {
            table = kuduClient.openTable(entityMetadata.getTableName());
        }
        catch (Exception e)
        {
            logger.error("Cannot open table : " + entityMetadata.getTableName(), e);
            throw new KunderaException("Cannot open table : " + entityMetadata.getTableName(), e);
        }
        Operation operation = isUpdate ? table.newUpdate() : table.newInsert();
        PartialRow row = operation.getRow();
        populatePartialRow(row, entityMetadata, entity);
        try
        {
            session.apply(operation);
        }
        catch (Exception e)
        {
            logger.error("Cannot insert/update row in table : " + entityMetadata.getTableName(), e);
            throw new KunderaException("Cannot insert/update row in table : " + entityMetadata.getTableName(), e);
        }
        finally
        {
            try
            {
                session.close();
            }
            catch (Exception e)
            {
                logger.error("Cannot close session", e);
                throw new KunderaException("Cannot close session", e);
            }
        }
    }
1126843
@Override
    public void onInteractionEvent(final InteractionEvent event) {
        QName id = event.getId();
        QName source = (QName)event.getSource();

        final Set<Procedure> collection = procedures.get(id);
        Procedure execution = null;

        if(collection!=null)
        {
            for(Procedure consumer : collection) {

                // TODO: This isn't optimal (creation of new resource with every comparison)
                Resource<ResourceType> resource = new Resource<ResourceType>(id, ResourceType.Interaction);
                resource.setSource(source);

                boolean justified = consumer.getJustification() == null
                        || source.equals(consumer.getJustification());

                if(consumer.doesConsume(resource) && justified)
                {
                    execution = consumer;
                    break;
                }
            }
        }

        if(null==execution)
        {
            Window.alert("No procedure for " + event);
            Log.warn("No procedure for " + event);
        }
        else if(execution.getPrecondition().isMet(getStatementContext(source)))   // guarded
        {
            try {
                execution.getCommand().execute(InteractionCoordinator.this.dialog, event.getPayload());
            } catch (Throwable e) {
                Log.error("Failed to execute procedure "+execution, e);
            }
        }

    }
1297424
private void setGeneratedKeyColumns(final SqlContext context, final MappingColumn[] idColumns,
			final TableMetadata metadata) {
		// 実行結果から生成されたIDを取得できるようにPreparedStatementにIDカラムを渡す
		if (idColumns != null && idColumns.length > 0) {
			List<String> keyColumnNames = new ArrayList<>();
			for (MappingColumn idColumn : idColumns) {
				for (TableMetadata.Column column : metadata.getColumns()) {
					if (idColumn.getCamelName().equals(column.getCamelColumnName())) {
						keyColumnNames.add(column.getColumnName());
						break;
					}
				}
			}
			context.setGeneratedKeyColumns(keyColumnNames.toArray(new String[keyColumnNames.size()]));
		}
	}
5942
@Override
	public String onColumnName(String columnName) {
		if (onlyBindParameter)
			return null;

		if (currentSchema != null) {
			Set<SQLProperty> props = currentSchema.getPropertyBySimpleName(columnName);
			AssertKripton.assertTrueOrUnknownPropertyInJQLException(props != null && props.size() > 0, currentMethod, columnName);
			return props.iterator().next().columnName;
		} else {
			return null;
		}
	}
320822
public void fillContent(List<CmsResourceTypeBean> typeInfos, List<String> selectedTypes) {

        if (m_types == null) {
            m_types = new HashMap<String, CmsResourceTypeBean>();
        }
        clearList();
        m_types.clear();
        for (CmsResourceTypeBean typeBean : typeInfos) {
            m_types.put(typeBean.getType(), typeBean);
            CmsListItemWidget listItemWidget;
            listItemWidget = new CmsListItemWidget(typeBean);
            listItemWidget.setUnselectable();
            CmsCheckBox checkBox = new CmsCheckBox();
            CmsListItem listItem = new CmsListItem(checkBox, listItemWidget);
            if (typeBean.isDeactivated()) {
                checkBox.disable("");
                listItem.addStyleName(
                    org.opencms.gwt.client.ui.css.I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().expired());
            } else {
                SelectionHandler selectionHandler = new SelectionHandler(typeBean.getType(), checkBox);
                checkBox.addClickHandler(selectionHandler);
                listItemWidget.addClickHandler(selectionHandler);
                if ((selectedTypes != null) && selectedTypes.contains(typeBean.getType())) {
                    checkBox.setChecked(true);
                }
                listItemWidget.addButton(createSelectButton(selectionHandler));

                if (typeBean.isCreatableType() && (m_dndHandler != null)) {
                    listItem.initMoveHandle(m_dndHandler, true);
                    listItem.getMoveHandle().setTitle(Messages.get().key(Messages.GUI_TAB_TYPES_CREATE_NEW_0));
                }
            }
            listItem.setId(typeBean.getType());

            if (typeBean.getVisibility() == TypeVisibility.showOptional) {
                listItem.addStyleName(I_CmsLayoutBundle.INSTANCE.galleryDialogCss().shouldOnlyShowInFullTypeList());
            }
            addWidgetToList(listItem);
        }
        updateTypeModeToggle();
    }
1363690
@Override
    public void onCreate(SQLiteDatabase db) {
        try {
            if(builder.tables == null){
                throw new SQLiteHelperException("The array of String tables can't be null!!");
            }
            executePragma(db);

            builder.onCreateCallback.onCreate(db);
        } catch (SQLiteHelperException e) {
            Log.e(this.getClass().toString(), Log.getStackTraceString(e), e);
        }
    }
521925
public static void main(String[] args) {
    int width = 6;
    int height = 10;
    Pentomino model = new Pentomino(width, height);
    List splits = model.getSplits(2);
    for(Iterator splitItr=splits.iterator(); splitItr.hasNext(); ) {
      int[] choices = (int[]) splitItr.next();
      System.out.print("split:");
      for(int i=0; i < choices.length; ++i) {
        System.out.print(" " + choices[i]);
      }
      System.out.println();
      
      System.out.println(model.solve(choices) + " solutions found.");
    }
  }