本文整理汇总了Java中org.twak.utils.collections.MultiMap类的典型用法代码示例。如果您正苦于以下问题:Java MultiMap类的具体用法?Java MultiMap怎么用?Java MultiMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiMap类属于org.twak.utils.collections包,在下文中一共展示了MultiMap类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clusterMinis
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
public static DumbCluster1D<MFPoint> clusterMinis( MegaFeatures mf, MultiMap<MegaFeatures, MFPoint> minis ) {
double mLen = mf.megafacade.length();
DumbCluster1D<MFPoint> clusters = new DumbCluster1D<MFPoint>(4, minis.get(mf)) {
@Override
public double toDouble( MFPoint pt ) {
return mf.megafacade.findPPram( pt ) * mLen;
}
};
Iterator<DumbCluster1D.Cluster<MFPoint>> dit = clusters.iterator(); // remove unpopular facade edges
while (dit.hasNext()) {
DumbCluster1D.Cluster<MFPoint> d = dit.next();
Set<ImageFeatures> coveringImages = d.things.stream().flatMap( p -> p.covering.stream() ).collect( Collectors.toSet() );
Set<ImageFeatures> usedImages = d.things.stream().map( p -> p.image ).collect( Collectors.toSet() );
if (usedImages.size() < coveringImages.size() - usedImages.size())
dit.remove();
}
return clusters;
}
示例2: SolverState
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
public SolverState(
HalfMesh2 mesh,
MultiMap<MegaFeatures, MFPoint> minis,
List<Prof> globalProfs,
Map<SuperEdge, double[]> profFit ) {
this.mesh = mesh;
this.minis = minis;
this.globalProfs = globalProfs;
this.profFit = profFit;
}
示例3: assignFeaturesToWindows
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
private void assignFeaturesToWindows(List<FRect> windows, MultiMap<Feature, FRect> rects) {
int count = 0;
for ( Feature f : new Feature[] { Feature.CORNICE, Feature.SILL, Feature.BALCONY } ) {
for ( FRect r : rects.get( f ) ) {
for (FRect w : windows) {
DRectangle bounds = new DRectangle(w);
bounds.height = bounds.height * 0.5;
switch ( f ) {
case SILL:
bounds.y = bounds.x - bounds.height;
break;
case BALCONY:
bounds.y = bounds.x;
break;
case CORNICE:
bounds.y = bounds.getMaxY();
break;
default:
break;
}
if (r.intersects( w )) {
w.attached.put( f, r );
count++;
}
}
FRect win = nearest( windows, r, 2 );
if ( win != null )
win.attached.put( f, r );
}
}
// System.out.println("atatched " + count +" cornicesesese");
}
示例4: findAdjacent
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
private static EdgePoint findAdjacent(Point3d start, Point3d not, MultiMap<Point3d, SharedEdge> boundary ) {
for (SharedEdge p : boundary.get(start)) {
if ( p.start.equals(start) && !p.end.equals(not) )
return new EdgePoint( p, p.end );
if ( p.end.equals(start) && !p.start.equals(not ) )
return new EdgePoint( p, p.start );
}
return null;
}
示例5: cap
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
private static void cap( MeshBuilder out, Collection<LinearForm3D> after,
Vector3d along, List<Point3d> profilePts, boolean reverse ) {
MultiMap<LinearForm3D, Point3d>faces = new MultiMap<>();
for (Point3d p : profilePts) {
List<LinearForm3D> hit = new ArrayList<>();
Point3d c = clip (p, along, after, hit);
for (LinearForm3D h : hit)
faces.put( h, c );
}
for (Map.Entry<LinearForm3D, List<Point3d>> e : faces.map.entrySet())
out.add ( new Loop<Point3d> ( e.getValue() ).singleton(), reverse );
}
示例6: FRect
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
public FRect( FRect o ) {
super(o);
f = o.f;
id = o.id;
outer = o.outer;
xi = o.xi;
yi = o.yi;
gridCoords = o.gridCoords == null ? null : Arrays.copyOf( o.gridCoords, o.gridCoords.length );
attached = new MultiMap<>( attached );
attachedHeight.cache = new HashMap<>( o.attachedHeight.cache );
}
示例7: findNoReturns
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
/**
* Valid points in output, only have one line along them
* @return
*/
private void findNoReturns()
{
// Set<Point3d> out = new HashSet();
MultiMap<Point3d, Point3d> toKill = new MultiMap();
for (Point3d pt : map.map.keySet())
{
for (Point3d goesTo : map.get(pt))
{
if (map.get(goesTo).contains(pt))
{
toKill.put(pt, goesTo);
toKill.put(goesTo, pt);
}
}
}
for (Point3d ptKill : toKill.map.keySet())
for (Point3d dest : toKill.get(ptKill))
{
map.remove(ptKill, dest);
Iterator<DataEdge<A>> dit = dataForPoint.get(ptKill).iterator();
while (dit.hasNext())
{
DataEdge<A> de = dit.next();
if (de.end.equals( dest ) )
dit.remove();
}
}
}
示例8: addPoints
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
/**
* a map from each plan marker, to the points it generated
* @param points
*/
public void addPoints ( MultiMap<Marker, Matrix4d> points )
{
// override me!
}
示例9: findChains
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
public static List<List<Face>> findChains (Output output) {
Set<Face> remaining = new LinkedHashSet<>(output.faces.values());
MultiMap<Face, Face> parent2children = new MultiMap<>();
while (!remaining.isEmpty()) {
Set<Face> above = new LinkedHashSet<>();
Face f = remaining.iterator().next();
do {
remaining.remove( f );
above.add( f );
if ( f.parent != null )
f = f.parent;
} while ( f.parent != null );
above.add(f);
parent2children.putAll( f, above, true );
}
return parent2children.keySet().stream().map ( f -> parent2children.get(f) ).collect( Collectors.toList() );
}
示例10: createMinis
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
public MultiMap<MegaFeatures, MFPoint> createMinis( BlockGen blockGen ) {
MultiMap<MegaFeatures, MFPoint> out = new MultiMap();
for (MegaFeatures m : getBlock (blockGen.center).getFeatures() ) {
double mLen = m.megafacade.length();
for ( ImageFeatures i : m.features ) {
for (int mi = 0; mi <= i.miniFacades.size(); mi++) {
MiniFacade n = mi < i.miniFacades.size() ? i.miniFacades.get(mi) : null,
p = (mi-1) >= 0 ? i.miniFacades.get(mi-1) : null;
if (n != null && ( n.width < MFWidthTol || (n.rects.countValue() == 0 && n.width < MFWidthTol* 3) ) ) // skinny mf filter
n = null;
if (p != null && ( p.width < MFWidthTol || (p.rects.countValue() == 0 && p.width < MFWidthTol * 3) ) )
p = null;
if ( n== null && p == null || n == null && p.softRight || p == null && n.softLeft ||
p != null && n != null && p.softRight && n.softLeft)
continue;
double ptDist = n == null ? ( p.left + p.width ) : n.left;
Point2d pt = m.megafacade.fromPPram( ptDist / mLen );
double covTol = 2;
Set<ImageFeatures> covering = m.features.stream()
.filter( ii -> ii.start + covTol < ptDist && ii.end > ptDist + covTol )
.collect( Collectors.toSet() );
double pa = m.megafacade.findPPram( pt ) * mLen; // stuff beyond the end of the facade
if ( pa < -5 || pa > mLen + 5)
continue;
out.put(m,new MFPoint (pt, covering, m, i, p, n) );
}
}
}
return out;
}
示例11: profileRuns
import org.twak.utils.collections.MultiMap; //导入依赖的package包/类
private static void profileRuns( SuperLine sl, MultiMap<SuperLine, List<Prof>> profSets ) {
MegaFacade mf = sl.getMega();
Cache<Integer, Double> distance2Next = new Cache<Integer, Double>() {
@Override
public Double create( Integer i ) {
Prof pc = mf.profiles.get(i), pn = mf.profiles.get(i+1);
if (pc == null || pn == null)
return 1e6;
return pc.distance (pn, true, false, false );
}
};
// i -> mf.profiles.get( i ).distance( mf.profiles.get(i+1), true ));
int start = mf.hExtentMin;
for (int i = mf.hExtentMin; i < mf.hExtentMax; i++) {
if ( distance2Next.get(i) > 4 || i == mf.hExtentMax - 1)
{
// if ( (Math.random() > 0.95 || i == mf.hExtentMax - 1) ){//0.5 / ProfileGen.HORIZ_SAMPLE_DIST) {
if (i - start > 0.5 / TweedSettings.settings.profileHSampleDist ) {
List<Prof> lp = IntStream.range( start, i+1 ).
mapToObj( p -> mf.profiles.get(p) ).
filter (p -> p != null).
collect( Collectors.toList() );
if (lp != null && !lp.isEmpty())
profSets.put (sl, lp);
}
start = i+1;
// i++;
// }
}
}
// System.out.println( (mf.hExtentMax - mf.hExtentMin)+ " mm " + min+ " / " + max +" found " + profSets.size() );
}