Returns the {@link Dictionary} used for this synthesizer.
The dictionary file can be defined in the {@link #BaseSynthesizer(String, String) constructor}.
@throws IOException In case the dictionary cannot be loaded.
423530
protected Dictionary getDictionary() throws IOException {
    Dictionary dict = this.dictionary;
    if (dict == null) {
      synchronized (this) {
        dict = this.dictionary;
        if (dict == null) {
          URL url = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(resourceFileName);
          this.dictionary = dict = Dictionary.read(url);
        }
      }
    }
    return dict;
  }
1347893
@Override
    public Dictionary<String, Object> getProperties() {
        lock.lock();
        try {
            exceptionIfDeleted();
            if (this.properties == null)
                return null;

            Dictionary<String, Object> copy = properties.copy();
            return copy;
        } finally {
            lock.unlock();
        }
    }
1269583
def getdict(source):
    
    std_dict = {}
    for var, val in source.iteritems():
        std_dict[var] = source[var]
    return std_dict
458233
def load_bytecode_definitions(*, path=None) -> dict:
    
    if path is not None:
        with open(path, 'rb') as file_in:
            j = json.load(file_in)
    else:
        try:
            j = json.loads(pkgutil.get_data('jawa.util', 'bytecode.json'))
        except json.JSONDecodeError:
            # Unfortunately our best way to handle missing/malformed/empty
            # bytecode.json files since it may not actually be backed by a
            # "real" file.
            return {}

    for definition in j.values():
        # If the entry has any operands take the text labels and convert
        # them into pre-cached struct objects and operand types.
        operands = definition['operands']
        if operands:
            definition['operands'] = [
                [getattr(OperandFmts, oo[0]), OperandTypes[oo[1]]]
                for oo in operands
            ]

    # Return one dict that contains both mnemonic keys and opcode keys.
    return {**j, **{v['op']: v for v in j.values()}}
81894
@SuppressWarnings("unchecked")
    public T dictionary(String dictionaryName) {
        Assert.notNull(applicationContext, "Citrus application context is not initialized!");
        DataDictionary dictionary = applicationContext.getBean(dictionaryName, DataDictionary.class);

        getAction().setDataDictionary(dictionary);
        return self;
    }
550094
public static JSONArray getBaseArray() {
		ensureLoaded();
		JSONArray baseArray = new JSONArray();
		for (VersionHistoryEntry entry : versionHistoryEntries) {
			baseArray.put(entry);
		}
		return baseArray;
	}
555087
public String getDictCanon() {
    if (DictTerm_Type.featOkTst && ((DictTerm_Type)jcasType).casFeat_DictCanon == null)
      jcasType.jcas.throwFeatMissing("DictCanon", "org.apache.uima.conceptMapper.DictTerm");
    return jcasType.ll_cas.ll_getStringValue(addr, ((DictTerm_Type)jcasType).casFeatCode_DictCanon);}
160948
public String getBaseClassName() {
        CodeGeneratorLoggerFactory.getLogger().debug(
                String.format("Reading base class name from data file [%s]", fileName));
        String baseClass = reader.getBaseClassName();
        if (baseClass == null) {
            String path = new File(fileName).getAbsolutePath();
            throw new IllegalArgumentException("Missing base class details in Data file :" + path);
        }
        return baseClass;
    }
619711
private static Iterator<String> getBaseIterator(BufferedReader reader,
                                                    boolean keepOrdering) {

        // The final iterator is how the stream will be tokenized after all the
        // tokenizing options have been applied.  This value is iteratively set
        // as the options are applied
        Iterator<String> finalIterator = new WordIterator(reader);

        // STEP 1: APPLY TOKEN REPLACEMENT
        if (replacementMap != null)
            finalIterator = 
                new WordReplacementIterator(finalIterator, replacementMap);

        // STEP 2: APPLY COMPOUND TOKENIZING
        if (compoundTokens != null) {
            // Because the initialization step for a CWI has some overhead, use
            // the reset to keep the same tokens.  However, multiple threads may
            // be each using their own CWI, so keep Thread-local storage of what
            // CWI is being used to avoid resetting another thread's iterator.
            CompoundWordIterator cwi = 
                compoundIterators.get(Thread.currentThread());
            if (cwi == null) {
                cwi = new CompoundWordIterator(finalIterator, compoundTokens);
                compoundIterators.put(Thread.currentThread(), cwi);
            } else {
                // NOTE: if the underlying set of valid compound words is ever
                // changed, the iterator returned from the compoundIterators map
                // will have been updated by the setProperties() call, so this
                // method is guaranteed to pick up the latest set of compound
                // words
                cwi.reset(finalIterator);
            }
            finalIterator = cwi;
        } 

        // STEP 3: APPLY TOKEN LIMITING
        if (wordLimit > 0)
            finalIterator = new LimitedIterator<String>(
                    finalIterator, wordLimit);

        // STEP 4: APPLY TOKEN FILTERING
        if (filter != null) {
            finalIterator = (keepOrdering)
                ? new OrderPreservingFilteredIterator(finalIterator, filter)
                : new FilteredIterator(finalIterator, filter);
        }

        // STEP 5: APPLY STEMMING
        if (stemmer != null) 
            finalIterator = new StemmingIterator(finalIterator, stemmer);

        return finalIterator;
    }
941311
public static IExtraLanguageConversionInitializer getTypeConverterInitializer() {
		return it -> {
			final List<Pair<String, String>> properties = loadPropertyFile(TYPE_CONVERSION_FILENAME);
			if (!properties.isEmpty()) {
				for (final Pair<String, String> entry : properties) {
					final String source = Objects.toString(entry.getKey());
					final String target = Objects.toString(entry.getValue());
					final String baseName;
					final Matcher matcher = TYPE_NAME_PAT.matcher(source);
					if (matcher.find()) {
						baseName = matcher.group(1);
					} else {
						baseName = source;
					}
					it.apply(baseName, source, target);
				}
			}
		};
	}
158284
@Override
    public Dictionary getDictionary(@NonNull String key) {
        if (key == null) { throw new IllegalArgumentException("key cannot be null."); }

        synchronized (lock) {
            final Object obj = getMValue(internalDict, key).asNative(internalDict);
            return obj instanceof Dictionary ? (Dictionary) obj : null;
        }
    }
183310
@Requires({
    "sourceDependencyLoader != null",
    "type != null"
  })
  @Ensures({
    "importNames != null",
    "rootLineNumberIterator != null"
  })
  @SuppressWarnings("unchecked")
  protected void fetchSourceDependency() throws IOException {
    String fileName = type.getName().getBinaryName()
        + JavaUtils.SOURCE_DEPENDENCY_EXTENSION;
    InputStream in =
        sourceDependencyLoader.getResourceAsStream(fileName);
    if (in == null) {
      throw new FileNotFoundException();
    }
    ObjectInputStream oin = new ObjectInputStream(in);
    try {
      importNames = (Set<String>) oin.readObject();
      rootLineNumberIterator = ((List<Long>) oin.readObject()).iterator();
    } catch (ClassNotFoundException e) {
      throw new IOException(e);
    }
    oin.close();
  }
215525
public JsonObject prepareNewDefinitions() throws IOException {

		ObjectMapper mapper = JSonBindingUtils.createObjectMapper();
		StringWriter writer = new StringWriter();
		JsonObject newDef = new JsonObject();

		// Copy the test application here as test-jars cannot be referenced
		// in compile scope.
		Application app = newTestApplication();

		// Create a model, as complete as possible
		app.bindWithApplication( "externalExportPrefix1", "application 1" );
		app.bindWithApplication( "externalExportPrefix1", "application 2" );
		app.bindWithApplication( "externalExportPrefix2", "application 3" );

		app.setName( "My Application with special chàràcters" );
		app.getTemplate().externalExports.put( "internalGraphVariable", "variableAlias" );
		app.getTemplate().setExternalExportsPrefix( "externalExportPrefix" );
		app.getTemplate().setDescription( "some description" );

		// Serialize things and generate the examples
		// (*) Applications
		writer = new StringWriter();
		mapper.writeValue( writer, app );
		String s = writer.toString();
		convertToTypes( s, Application.class, newDef );

		// (*) Application Templates
		writer = new StringWriter();
		mapper.writeValue( writer, app.getTemplate());
		s = writer.toString();
		convertToTypes( s, ApplicationTemplate.class, newDef );

		// (*) Component
		Instance war = InstanceHelpers.findInstanceByPath( app, "/tomcat-vm/tomcat-server/hello-world" );
		Objects.requireNonNull( war );

		writer = new StringWriter();
		mapper.writeValue( writer, war.getComponent());
		s = writer.toString();
		convertToTypes( s, Component.class, newDef );

		// (*) Instance
		writer = new StringWriter();
		mapper.writeValue( writer, war );
		s = writer.toString();
		convertToTypes( s, Instance.class, newDef );

		// (*) Diagnostics
		Diagnostic diag = new Diagnostic( "/vm1/server1" );
		DependencyInformation di = new DependencyInformation( "facetOrComponentName", true, false );
		diag.getDependenciesInformation().add( di );

		writer = new StringWriter();
		mapper.writeValue( writer, diag );
		s = writer.toString();
		convertToTypes( s, Diagnostic.class, newDef );

		writer = new StringWriter();
		mapper.writeValue( writer, di );
		s = writer.toString();
		convertToTypes( s, DependencyInformation.class, newDef );

		// (*) Target descriptors
		TargetWrapperDescriptor twd = new TargetWrapperDescriptor();
		twd.setId( "target-id" );
		twd.setDescription( "some description" );
		twd.setHandler( "iaas-ec2" );
		twd.setName( "target name" );
		twd.setDefault( true );

		writer = new StringWriter();
		mapper.writeValue( writer, twd );
		s = writer.toString();
		convertToTypes( s, TargetWrapperDescriptor.class, newDef );

		// (*) Target usage items
		TargetUsageItem tui = new TargetUsageItem();
		tui.setName( "app or template name" );
		tui.setVersion( "template qualifier (null for applications)" );
		tui.setReferencing( true );
		tui.setUsing( true );

		writer = new StringWriter();
		mapper.writeValue( writer, tui );
		s = writer.toString();
		convertToTypes( s, TargetUsageItem.class, newDef );

		// (*) Target associations
		TargetAssociation ta = new TargetAssociation( "/vm-1", "VM", twd );

		writer = new StringWriter();
		mapper.writeValue( writer, ta );
		s = writer.toString();
		convertToTypes( s, TargetAssociation.class, newDef );

		// (*) Preferences
		Preference pref = new Preference( "key", "value", PreferenceKeyCategory.AUTONOMIC );

		writer = new StringWriter();
		mapper.writeValue( writer, pref );
		s = writer.toString();
		convertToTypes( s, Preference.class, newDef );

		// (*) Scheduled jobs
		ScheduledJob job = new ScheduledJob();
		job.setAppName( "application name" );
		job.setCmdName( "command name" );
		job.setCron( "0 0 12 ? * WED" );
		job.setJobId( "job-id" );
		job.setJobName( "job name" );

		writer = new StringWriter();
		mapper.writeValue( writer, job );
		s = writer.toString();
		convertToTypes( s, ScheduledJob.class, newDef );

		return newDef;
	}
777701
public Record
_nextRecord() throws IOException {
	Tokenizer.Token token;
	String s;

	if (included != null) {
		Record rec = included.nextRecord();
		if (rec != null)
			return rec;
		included = null;
	}
	if (generator != null) {
		Record rec = nextGenerated();
		if (rec != null)
			return rec;
		endGenerate();
	}
	while (true) {
		Name name;

		token = st.get(true, false);
		if (token.type == Tokenizer.WHITESPACE) {
			Tokenizer.Token next = st.get();
			if (next.type == Tokenizer.EOL)
				continue;
			else if (next.type == Tokenizer.EOF)
				return null;
			else
				st.unget();
			if (last == null)
				throw st.exception("no owner");
			name = last.getName();
		}
		else if (token.type == Tokenizer.EOL)
			continue;
		else if (token.type == Tokenizer.EOF)
			return null;
		else if (((String) token.value).charAt(0) == '$') {
			s = token.value;

			if (s.equalsIgnoreCase("$ORIGIN")) {
				origin = st.getName(Name.root);
				st.getEOL();
				continue;
			} else if (s.equalsIgnoreCase("$TTL")) {
				defaultTTL = st.getTTL();
				st.getEOL();
				continue;
			} else  if (s.equalsIgnoreCase("$INCLUDE")) {
				String filename = st.getString();
				File newfile;
				if (file != null) {
					String parent = file.getParent();
					newfile = new File(parent, filename);
				} else {
					newfile = new File(filename);
				}
				Name incorigin = origin;
				token = st.get();
				if (token.isString()) {
					incorigin = parseName(token.value,
							      Name.root);
					st.getEOL();
				}
				included = new Master(newfile, incorigin,
						      defaultTTL);
				/*
				 * If we continued, we wouldn't be looking in
				 * the new file.  Recursing works better.
				 */
				return nextRecord();
			} else  if (s.equalsIgnoreCase("$GENERATE")) {
				if (generator != null)
					throw new IllegalStateException
						("cannot nest $GENERATE");
				startGenerate();
				if (noExpandGenerate) {
					endGenerate();
					continue;
				}
				return nextGenerated();
			} else {
				throw st.exception("Invalid directive: " + s);
			}
		} else {
			s = token.value;
			name = parseName(s, origin);
			if (last != null && name.equals(last.getName())) {
				name = last.getName();
			}
		}

		parseTTLClassAndType();
		last = Record.fromString(name, currentType, currentDClass,
					 currentTTL, st, origin);
		if (needSOATTL) {
			long ttl = ((SOARecord)last).getMinimum();
			last.setTTL(ttl);
			defaultTTL = ttl;
			needSOATTL = false;
		}
		return last;
	}
}
1251169
public static DictionaryMetadata read(InputStream metadataStream) throws IOException {
    Map<DictionaryAttribute, String> map = new HashMap<DictionaryAttribute, String>();
    final Properties properties = new Properties();
    properties.load(new InputStreamReader(metadataStream, "UTF-8"));

    // Handle back-compatibility for encoder specification.
    if (!properties.containsKey(DictionaryAttribute.ENCODER.propertyName)) {
      boolean hasDeprecated = properties.containsKey("fsa.dict.uses-suffixes") ||
                              properties.containsKey("fsa.dict.uses-infixes") ||
                              properties.containsKey("fsa.dict.uses-prefixes");

      boolean usesSuffixes = Boolean.valueOf(properties.getProperty("fsa.dict.uses-suffixes", "true"));
      boolean usesPrefixes = Boolean.valueOf(properties.getProperty("fsa.dict.uses-prefixes", "false"));
      boolean usesInfixes  = Boolean.valueOf(properties.getProperty("fsa.dict.uses-infixes",  "false"));

      final EncoderType encoder;
      if (usesInfixes) {
        encoder = EncoderType.INFIX;
      } else if (usesPrefixes) {
        encoder = EncoderType.PREFIX;
      } else if (usesSuffixes) {
        encoder = EncoderType.SUFFIX;
      } else {
        encoder = EncoderType.NONE;
      }

      if (!hasDeprecated) {
        throw new IOException("Use an explicit " +
            DictionaryAttribute.ENCODER.propertyName + "=" + encoder.name() +
            " metadata key: ");
      }

      throw new IOException("Deprecated encoder keys in metadata. Use " +
          DictionaryAttribute.ENCODER.propertyName + "=" + encoder.name());
    }

    for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
      String key = (String) e.nextElement();
      map.put(DictionaryAttribute.fromPropertyName(key), properties.getProperty(key));
    }

    return new DictionaryMetadata(map);
  }
1362690
public static ImmutableMap<String, String> dictionary(final Class<?> origin, final String resource)
            throws IOException {
        return ImmutableMap.copyOf(new HashMap<String, String>() {{
            readResource(origin, resource, new NullReturnLineProcessor() {
                @Override
                public boolean processLine(@Nonnull final String line) {
                    final String l = simplify(line);
                    if (!l.isEmpty() && !l.startsWith("#")) {
                        final List<String> parts = TABS.splitToList(l);
                        // add the parts to the map we are in the init block of
                        put(parts.get(0), parts.get(1));
                    }
                    return true;
                }
            });
        }});
    }
1069013
public JSONObject toJson() throws IOException {
    String base64 = new Zip().zip(getDirectory());
    Map<String, String> map = ImmutableMap.of(
      "className", this.getClass().getName(),
      BASE64_JSON_KEY, base64);
    
    return new JSONObject(map);
  }