Get crop id with 2-bit format

@param result date holder for experiment data
@return crop id
968536
protected String getCrid(Map result) {

        HashMap mgnData = getObjectOr(result, "management", new HashMap());
        ArrayList<HashMap> events = getObjectOr(mgnData, "events", new ArrayList());
        String crid = null;
        boolean isPlEventExist = false;
        for (HashMap event : events) {
            if ("planting".equals(event.get("event"))) {
                isPlEventExist = true;
                if (crid == null) {
                    crid = (String) event.get("crid");
                } else if (!crid.equals(event.get("crid"))) {
                    return "SQ";
                }
            }
        }
        if (crid == null) {
            crid = getValueOr(result, "crid", "XX");
        }
        if (!isPlEventExist && "XX".equals(crid)) {
            return "FA";
        } else {
//            DssatCRIDHelper crids = new DssatCRIDHelper();
            return DssatCRIDHelper.get2BitCrid(crid);
        }
    }
839927
public static String id(Resource res) {
	String str = ResourceUtil.getCanonicalPathEL(res) + "|" + res.length() + "|" + res.lastModified();
	try {
	    return Hash.md5(str);
	}
	catch (NoSuchAlgorithmException e) {
	    return Caster.toString(HashUtil.create64BitHash(str));
	}
    }
1297444
@Override
    public void writeFile(String arg0, Map result) {

        // Initial variables
        BufferedWriter bwR;                         // output object

        try {

            // Get version number
            if (dssatVerStr == null) {
                dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", "");
                if (!dssatVerStr.matches("\\d+")) {
                    dssatVerStr = DssatBatchFileOutput.DssatVersion.DSSAT45.toString();
                }
            }

            // Initial BufferedWriter
            arg0 = revisePath(arg0);
            outputFile = new File(arg0 + "Run" + dssatVerStr + ".bat");
            bwR = new BufferedWriter(new FileWriter(outputFile));

            // Output Run File
            bwR.write("C:\\dssat" + dssatVerStr + "\\dscsm0" + dssatVerStr + " b dssbatch.v" + dssatVerStr + "\r\n");
            bwR.write("@echo off\r\n");
            bwR.write("pause\r\n");
            bwR.write("exit\r\n");

            // Output finish
            bwR.close();
        } catch (IOException e) {
            LOG.error(DssatCommonOutput.getStackTrace(e));
        }
    }
1366891
public static String getExpressionKey(String result)
   {
      if (result == null)
         return null;
      try
      {
         int from = result.indexOf(startTag);
         int to = result.indexOf(endTag, from);
         Integer.parseInt(result.substring(from + 5, to));
         return result.substring(from, to + 5);
      }
      catch (Exception e)
      {
         return null;
      }
   }
756514
private function formatUrlStat($result = null)
    {
        $stat = $this->getStatTemplate();
        switch (gettype($result)) {
            case 'NULL':
            case 'string':
                // Directory with 0777 access - see "man 2 stat".
                $stat['mode'] = $stat[2] = 0040777;
                break;
            case 'array':
                // Regular file with 0777 access - see "man 2 stat".
                $stat['mode'] = $stat[2] = 0100777;
                // Pluck the content-length if available.
                if (isset($result['ContentLength'])) {
                    $stat['size'] = $stat[7] = $result['ContentLength'];
                } elseif (isset($result['Size'])) {
                    $stat['size'] = $stat[7] = $result['Size'];
                }
                if (isset($result['LastModified'])) {
                    // ListObjects or HeadObject result
                    $stat['mtime'] = $stat[9] = $stat['ctime'] = $stat[10]
                        = strtotime($result['LastModified']);
                }
        }

        return $stat;
    }
1130321
@Direct
  @Override
  public void getStream(RowCursor cursor, 
                        Result<GetStreamResult> result)
  {
    long version = cursor.getVersion();
    
    PageLeafImpl leaf = getLeafByCursor(cursor);
    
    if (leaf == null) {
      result.ok(new GetStreamResult(false, null));
      return;
    }
    
    if (! leaf.get(cursor)) {
      result.ok(new GetStreamResult(false, null));
      return;
    }

    if (version == cursor.getVersion()) {
      result.ok(new GetStreamResult(true, null));
      return;
    }
    
    StreamSource ss = leaf.getStream(cursor, this);
    
    boolean isFound = ss != null;

    result.ok(new GetStreamResult(isFound, ss));
  }
581572
public static DispatcherResult extractDispatcherResult(final StepExecutionResult result) {
        Optional<NodeDispatchStepExecutorResult> extracted = extractNodeDispatchStepExecutorResult(result);
        if (!extracted.isPresent()) {
            throw new IllegalArgumentException("Cannot extract result: unexpected type: " + result);
        }
        return extracted.get().getDispatcherResult();
    }
1285923
public com.google.protobuf.ByteString
      getProducerProjectIdBytes() {
    java.lang.Object ref = producerProjectId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      producerProjectId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
688194
@Override
  public ISBNParsedResult parse(Result result) {
    BarcodeFormat format = result.getBarcodeFormat();
    if (format != BarcodeFormat.EAN_13) {
      return null;
    }
    String rawText = getMassagedText(result);
    int length = rawText.length();
    if (length != 13) {
      return null;
    }
    if (!rawText.startsWith("978") && !rawText.startsWith("979")) {
      return null;
    }
   
    return new ISBNParsedResult(rawText);
  }
28036
public com.google.api.ads.adwords.axis.v201809.cm.Operand getResult() {
        return result;
    }
222525
public static String generateWithSign(){
		Date date = new Date();
		String cryptKey = getCryptKey(date);
		String str = DigestUtils.md5Short(generate()).concat(String.valueOf(date.getTime()));	
		return DES.encrypt(cryptKey, str).toLowerCase();
	}
456145
public static SQLiteEvent createInsertWithUid(String result) {
		return new SQLiteEvent(SqlModificationType.INSERT, null, null, result);
	}
16630
@Override
  public URIParsedResult parse(Result result) {
    String rawText = getMassagedText(result);
    // We specifically handle the odd "URL" scheme here for simplicity and add "URI" for fun
    // Assume anything starting this way really means to be a URI
    if (rawText.startsWith("URL:") || rawText.startsWith("URI:")) {
      return new URIParsedResult(rawText.substring(4).trim(), null);
    }
    rawText = rawText.trim();
    if (!isBasicallyValidURI(rawText) || isPossiblyMaliciousURI(rawText)) {
      return null;
    }
    return new URIParsedResult(rawText, null);
  }
634402
public static String getFailureDescriptionAsString(final ModelNode result) {
        if (isSuccessfulOutcome(result)) {
            return "";
        }
        final String msg;
        if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) {
            if (result.hasDefined(ClientConstants.OP)) {
                msg = String.format("Operation '%s' at address '%s' failed: %s", result.get(ClientConstants.OP), result.get(ClientConstants.OP_ADDR), result
                        .get(ClientConstants.FAILURE_DESCRIPTION));
            } else {
                msg = String.format("Operation failed: %s", result.get(ClientConstants.FAILURE_DESCRIPTION));
            }
        } else {
            msg = String.format("An unexpected response was found checking the deployment. Result: %s", result);
        }
        return msg;
    }
1223805
private boolean getThenPerformAdj(int operation, int position, boolean value) {
		checkMutable();
		final int i = position >> ADDRESS_BITS;
		final long m = 1L << (position & ADDRESS_MASK);
		final long v = bits[i] & m;
		switch(operation) {
		case SET :
			if (value) {
				bits[i] |=  m;
			} else {
				bits[i] &= ~m;
			}
			break;
		case AND :
			if (value) {
				/* no-op */
			} else {
				bits[i] &= ~m;
			}
			break;
		case OR :
			if (value) {
				bits[i] |=  m;
			} else {
				/* no-op */
			}
			break;
		case XOR :
			if (value) {
				bits[i] ^=  m;
			} else {
				/* no-op */
			}
			break;
		}
		return v != 0;
	}
304433
public static Result createResultForStage1(Result result) {
    VariableMap emptyVariableMap = new VariableMap(ImmutableMap.of());
    return new Result(
        result.errors,
        result.warnings,
        emptyVariableMap,
        emptyVariableMap,
        emptyVariableMap,
        null,
        null,
        "",
        null,
        null,
        null);
  }
371162
private List<String> formatResult(Result result, Server server) {
		List<String> resultStrings = new LinkedList<>();

		if (result.getValuePath().isEmpty()) {
			processOneMetric(resultStrings, server, result, result.getValue(), null, null);
		} else {
			processOneMetric(resultStrings, server, result, result.getValue(), tagName, StringUtils.join(result.getValuePath(), '.'));
		}
		return resultStrings;
	}