CPD Results

The following document contains the results of PMD's CPD 5.2.1.

Duplications

File Line
pl/frati/teryt/service/client/api/CommuneBase.java 58
pl/frati/teryt/service/client/api/PoviatBase.java 50
	}

	@Override
	public Date getLastUpdate()
	{
		return lastUpdate;
	}

	@Override
	public String toString()
	{
		return name + " [" + id + "]";
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((lastUpdate == null) ? 0 : lastUpdate.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((partialTerc == null) ? 0 : partialTerc.hashCode());
		result = prime * result + ((poviat == null) ? 0 : poviat.hashCode());
File Line
pl/frati/teryt/service/client/api/CityNaturalOrderComparator.java 53
pl/frati/teryt/service/client/api/CityPartNaturalOrderComparator.java 49
pl/frati/teryt/service/client/api/PoviatNaturalOrderComparator.java 53
pl/frati/teryt/service/client/api/VoivodshipNaturalOrderComparator.java 49
	public int compare(City o1, City o2)
	{
		CollationKey o1CollationKey = collationKeys.get(o1.getName());
		CollationKey o2CollationKey = collationKeys.get(o2.getName());

		if ((o1CollationKey == null) || (o2CollationKey == null))
		{
			Collator collator = Collator.getInstance(new Locale("pl", "PL"));

			if (o1CollationKey == null)
			{
				o1CollationKey = collator.getCollationKey(o1.getName());
				collationKeys.put(o1.getName(), o1CollationKey);
			}

			if (o2CollationKey == null)
			{
				o2CollationKey = collator.getCollationKey(o2.getName());
				collationKeys.put(o2.getName(), o2CollationKey);
			}
		}

		return o1CollationKey.compareTo(o2CollationKey);
	}

	/**
	 * Metoda pobiera instancję komparatora
	 * 
	 * @return Instancja komparatora
	 */
	public static CityNaturalOrderComparator getInstance()
File Line
pl/frati/teryt/service/client/api/CityNaturalOrderComparator.java 53
pl/frati/teryt/service/client/api/CityPartNaturalOrderComparator.java 49
pl/frati/teryt/service/client/api/CommuneNaturalOrderComparator.java 74
pl/frati/teryt/service/client/api/PoviatNaturalOrderComparator.java 53
pl/frati/teryt/service/client/api/VoivodshipNaturalOrderComparator.java 49
	public int compare(City o1, City o2)
	{
		CollationKey o1CollationKey = collationKeys.get(o1.getName());
		CollationKey o2CollationKey = collationKeys.get(o2.getName());

		if ((o1CollationKey == null) || (o2CollationKey == null))
		{
			Collator collator = Collator.getInstance(new Locale("pl", "PL"));

			if (o1CollationKey == null)
			{
				o1CollationKey = collator.getCollationKey(o1.getName());
				collationKeys.put(o1.getName(), o1CollationKey);
			}

			if (o2CollationKey == null)
			{
				o2CollationKey = collator.getCollationKey(o2.getName());
				collationKeys.put(o2.getName(), o2CollationKey);
			}
		}
File Line
pl/frati/teryt/service/client/api/CommuneBase.java 58
pl/frati/teryt/service/client/api/PoviatBase.java 50
pl/frati/teryt/service/client/api/VoivodshipBase.java 40
	}

	@Override
	public Date getLastUpdate()
	{
		return lastUpdate;
	}

	@Override
	public String toString()
	{
		return name + " [" + id + "]";
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((lastUpdate == null) ? 0 : lastUpdate.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
File Line
pl/frati/teryt/service/client/api/CityBase.java 104
pl/frati/teryt/service/client/api/VoivodshipBase.java 64
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((lastUpdate == null) ? 0 : lastUpdate.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}
		if (obj == null)
		{
			return false;
		}
		if (!(obj instanceof City))