新增Task，使用随机UUID

@param pattern {@link CronPattern}对应的String表达式
@param task {@link Task}
@return ID
518355
public String schedule(String pattern, Task task) {
		String id = UUID.randomUUID().toString();
		schedule(id, pattern, task);
		return id;
	}
509181
public static String formatUTC(final long millis, final String pattern) {
        return format(new Date(millis), pattern, UTC_TIME_ZONE, null);
    }
1178580
@Override
    String execute(final Task task) {
        if (Config.DEBUG) {
            Log.v(TAG, "execute() task=" + task);
        }
        checkExecutor();
        assert task != null;
        final ITaskRunnable runnable = TaskFactory.createRunnable(task);
        final String group = task.getGroup();
        final String name = task.getName();
        addToRunnableMap(name, runnable);
        addToGroupMap(name, group);

        runnable.setFuture(mExecutor.submit(runnable));
        return name;
    }
877169
protected String convertIdentifierPattern(final String pattern, boolean datanucleusFormat) {
    if (pattern == null) {
      return convertPattern("%", true);
    } else {
      return convertPattern(pattern, datanucleusFormat);
    }
  }
235139
public static Date getNextScheduled(Object task) {

        if (task instanceof Task) {
            final Task ltask = (Task) task;
            final long next  = ltask.isCancelled() ? 0
                                                   : ltask.getNextScheduled();

            return next == 0 ? null
                             : new Date(next);
        } else {
            return null;
        }
    }
580758
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task)
   {
      ProjectCalendar calendar = null;

      BigInteger calendarID = task.getCalendarUID();
      if (calendarID != null)
      {
         calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue()));
      }

      return (calendar);
   }
795313
private void parseSinglePattern(String pattern) {
		final String[] parts = pattern.split("\\s");

		int offset = 0;// 偏移量用于兼容Quartz表达式，当表达式有6或7项时，第一项为秒
		if (parts.length == 6 || parts.length == 7) {
			offset = 1;
		} else if (parts.length != 5) {
			throw new CronException("Pattern [{}] is invalid, it must be 5-7 parts!", pattern);
		}

		// 秒
		if (1 == offset) {// 支持秒的表达式
			try {
				this.secondMatchers.add(ValueMatcherBuilder.build(parts[0], SECOND_VALUE_PARSER));
			} catch (Exception e) {
				throw new CronException(e, "Invalid pattern [{}], parsing 'second' field error!", pattern);
			}
		} else {// 不支持秒的表达式，则第一位按照表达式生成时间的秒数赋值，表示整分匹配
			this.secondMatchers.add(ValueMatcherBuilder.build(String.valueOf(DateUtil.date().second()), SECOND_VALUE_PARSER));
		}
		// 分
		try {
			this.minuteMatchers.add(ValueMatcherBuilder.build(parts[0 + offset], MINUTE_VALUE_PARSER));
		} catch (Exception e) {
			throw new CronException(e, "Invalid pattern [{}], parsing 'minute' field error!", pattern);
		}
		// 小时
		try {
			this.hourMatchers.add(ValueMatcherBuilder.build(parts[1 + offset], HOUR_VALUE_PARSER));
		} catch (Exception e) {
			throw new CronException(e, "Invalid pattern [{}], parsing 'hour' field error!", pattern);
		}
		// 每月第几天
		try {
			this.dayOfMonthMatchers.add(ValueMatcherBuilder.build(parts[2 + offset], DAY_OF_MONTH_VALUE_PARSER));
		} catch (Exception e) {
			throw new CronException(e, "Invalid pattern [{}], parsing 'day of month' field error!", pattern);
		}
		// 月
		try {
			this.monthMatchers.add(ValueMatcherBuilder.build(parts[3 + offset], MONTH_VALUE_PARSER));
		} catch (Exception e) {
			throw new CronException(e, "Invalid pattern [{}], parsing 'month' field error!", pattern);
		}
		// 星期几
		try {
			this.dayOfWeekMatchers.add(ValueMatcherBuilder.build(parts[4 + offset], DAY_OF_WEEK_VALUE_PARSER));
		} catch (Exception e) {
			throw new CronException(e, "Invalid pattern [{}], parsing 'day of week' field error!", pattern);
		}
		// 年
		if (parts.length == 7) {// 支持年的表达式
			try {
				this.yearMatchers.add(ValueMatcherBuilder.build(parts[6], YEAR_VALUE_PARSER));
			} catch (Exception e) {
				throw new CronException(e, "Invalid pattern [{}], parsing 'year' field error!", pattern);
			}
		} else {// 不支持年的表达式，全部匹配
			this.secondMatchers.add(new AlwaysTrueValueMatcher());
		}
		matcherSize++;
	}
1062552
public static String newTaskId(String jobId, int sequence) {
    return Id.Task.create(Id.parse(jobId).get(Id.Parts.INSTANCE_NAME), sequence).toString();
  }
1071364
public String schedule(TriggerTask task) {
        if (getCurrentScheduler() == null) {
            throw new IllegalStateException("New scheduler should be crea");
        }
        ScheduledFuture<?> future = getCurrentScheduler().schedule(task.getRunnable(), task.getTrigger());
        String id = Schedulers.getUUID();
        runningSchedullers.put(id, future);
        Schedulers.increaseNoOfRunningSchedullers();
        setCurrentScheduler(null);
        return id;
    }
561746
public void setDataFormat(final String pattern, final CellFormatter cellFormatter) {

        String currentPattern = POIUtils.getCellFormatPattern(cell, cellFormatter);
        if(currentPattern.equalsIgnoreCase(pattern)) {
            // 既に書式が同じ場合
            return;
        }

        cloneStyle();
        cell.getCellStyle().setDataFormat(POIUtils.getDataFormatIndex(cell.getSheet(), pattern));

    }
529203
public static String format(final ZonedDateTime self, String pattern) {
        return self.format(DateTimeFormatter.ofPattern(pattern));
    }
356326
public CustomFormatter create(final String pattern) {
        
        final CustomFormatTokenizer tokenizer = new CustomFormatTokenizer();
        final TokenStore allStore = tokenizer.parse(pattern);
        if(allStore.getTokens().isEmpty()) {
            // 標準のフォーマッタ
            return CustomFormatter.DEFAULT_FORMATTER;
            
        } else if(pattern.equalsIgnoreCase("General")) {
            return CustomFormatter.DEFAULT_FORMATTER;
        }
        
        // セクション単位に分割し、処理していく。
        final List<TokenStore> sections = allStore.split(Token.SYMBOL_SEMI_COLON);
        if(sections.size() > 4) {
            throw new CustomFormatterParseException(pattern,
                    String.format("section size over 4. but '%s' number of %d secitions.", pattern, sections.size()));
        }
        
        final CustomFormatter formatter = new CustomFormatter(pattern);
        boolean containsTextFormatter = false;
        for(TokenStore section : sections) {
            
            final ConditionFormatter conditionFormatter;
            if(textFormatterFactory.isTextPattern(section)) {
                conditionFormatter = textFormatterFactory.create(section);
                containsTextFormatter = true;
                
            } else if(dateFormatterFactory.isDatePattern(section)) {
                conditionFormatter = dateFormatterFactory.create(section);
                
            } else if(numberFormatterFactory.isNumberPattern(section)) {
                conditionFormatter = numberFormatterFactory.create(section);
                
            } else {
                conditionFormatter = numberFormatterFactory.create(section);
                
            }
            
            formatter.addConditionFormatter(conditionFormatter);
            
        }
        
        // 条件式の設定
        int sectionSize = sections.size();
        if(containsTextFormatter) {
            // 文字列の書式を含む場合は、個数から除外する。
            sectionSize--;
        }
        
        // 1番目の書式がデフォルトの条件の場合
        boolean hasConditionFirst = false;
        
        for(int i=0; i < sectionSize; i++) {
            
            final ConditionFormatter conditionFormatter = formatter.getConditionFormatters().get(i);
            if(conditionFormatter.getOperator() != null) {
                if(i == 0) {
                    hasConditionFirst = true;
                }
                continue;
            }
            
            if(sectionSize <= 1) {
                // 書式が1つしかない場合
                conditionFormatter.setOperator(ConditionOperator.ALL);
                
            } else if(sectionSize == 2) {
                if(i==0) {
                    // ゼロ以上の数の書式
                    conditionFormatter.setOperator(ConditionOperator.NON_NEGATIVE);
                    
                } else if(i==1) {
                    // その他の書式
                    if(hasConditionFirst) {
                        conditionFormatter.setOperator(ConditionOperator.ALL);
                    } else {
                        conditionFormatter.setOperator(ConditionOperator.NEGATIVE);
                    }
                }
                
            } else if(sectionSize == 3) {
                if(i==0) {
                    // 正の書式
                    conditionFormatter.setOperator(ConditionOperator.POSITIVE);
                    
                } else if(i==1) {
                    // 負の数の書式
                    conditionFormatter.setOperator(ConditionOperator.NEGATIVE);
                    
                } else {
                    // その他の書式
                    conditionFormatter.setOperator(ConditionOperator.ALL);
                    
                }
                
            } else if(sectionSize == 4) {
                if(i==0) {
                    // 正の書式
                    conditionFormatter.setOperator(ConditionOperator.POSITIVE);
                    
                } else if(i==1) {
                    // 負の数の書式
                    conditionFormatter.setOperator(ConditionOperator.NEGATIVE);
                    
                } else if(i==2) {
                    // ゼロの書式
                    conditionFormatter.setOperator(ConditionOperator.ZERO);
                    
                } else {
                    // その他の書式
                    conditionFormatter.setOperator(ConditionOperator.ALL);
                    
                }
                
            } else {
                throw new CustomFormatterParseException(pattern,
                        String.format("section size over 4. but '%s' number of %d secitions.", pattern, sections.size()));
            }
            
        }
        
        return formatter;
    }
426194
@Override
	public Protos.TaskID newTaskID() throws Exception {
		synchronized (startStopLock) {
			verifyIsRunning();

			int nextCount;
			boolean success;
			do {
				ZooKeeperVersionedValue<Integer> count = totalTaskCountInZooKeeper.getVersionedValue();
				nextCount = count.getValue() + 1;
				success = totalTaskCountInZooKeeper.trySetCount(count, nextCount);
			}
			while (!success);

			Protos.TaskID taskID = Protos.TaskID.newBuilder().setValue(TASKID_FORMAT.format(nextCount)).build();
			return taskID;
		}
	}
600111
private static SimpleDateFormat buildDateFormat(final String pattern) {

    SimpleDateFormat simpleDateFormat = simpleDateFormatCache.get();
    if (simpleDateFormat == null) {
      simpleDateFormat = new SimpleDateFormat();
      simpleDateFormatCache.set(simpleDateFormat);
    }
    simpleDateFormat.applyPattern(pattern);
    return simpleDateFormat;
  }
1043939
public Scheduler updatePattern(String id, CronPattern pattern) {
		this.taskTable.updatePattern(id, pattern);
		return this;
	}
904447
@Override
    public Future<?> submit(Runnable task) {
        ExecutorService executor = getScheduledExecutor();
        try {
            return executor.submit(errorHandlingTask(task, false));
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
        }
    }
846708
public String getSkeleton(String pattern) {
        synchronized (this) { // synchronized since a getter must be thread-safe
            current.set(pattern, fp, false);
            return current.toString();
        }
    }